first commit

This commit is contained in:
ct
2023-07-25 01:06:06 +08:00
commit 94e320735c
133 changed files with 15373 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?php
if (! function_exists('is_empty')) {
/**
* A better function to check if a value is empty or null. Strings, arrays, and Objects are supported.
*
* @param mixed $value
* @return bool
*/
function is_empty($value): bool
{
if (is_null($value)) {
return true;
}
if (is_string($value)) {
if ($value === '') {
return true;
}
}
if (is_array($value)) {
if (count($value) === 0) {
return true;
}
}
if (is_object($value)) {
$value = (array) $value;
if (count($value) === 0) {
return true;
}
}
return false;
}
}