массив пустая проверка в php
if (empty($array)) {
// list is empty.
}
Hjmcoder
if (empty($array)) {
// list is empty.
}
if (typeof array !== 'undefined' && array.length === 0) {
// the array is defined and has no elements
}
if (array === undefined || array.length == 0) {
// array empty or does not exist
}
if (array && !array.length) {
// array is defined but has no element
}
$arr = array();
if(!empty($arr)){
echo "not empty";
}
else
{
echo "empty";
}
const isNotEmpty = arr => Array.isArray(arr) && arr.length > 0;
isNotEmpty([1, 2, 3]);
// Result: true