not empty array code example
Example 1: array empty check in php
if (empty($array)) {
// list is empty.
}
Example 2: javascript check if array is not empty
if (array === undefined || array.length == 0) {
// array empty or does not exist
}
Example 3: javascript not empty array not string
if (Array.isArray(array) && array.length) {
// array exists and is not empty
}
Example 4: javascript is array empty
var colors=[];
if(!colors.length){
// I am empty
}else{
// I am not empty
}
Example 5: how to make array empty
A.length = 0
Example 6: php empty array
//To clear array you are able to simply re-instantiate it
$foo = array();
//To clear $foo from the symbol table use
unset($foo);