I've var dumped my array:
array(4) { [0]=> string(72) " 1 " [1]=> string(57) " 2 " [2]=> string(63) " › " [3]=> string(63) " » " } When I check:
empty($myArray); It always says true. Why is this?
I've var dumped my array:
array(4) { [0]=> string(72) " 1 " [1]=> string(57) " 2 " [2]=> string(63) " › " [3]=> string(63) " » " } When I check:
empty($myArray); It always says true. Why is this?
Alternatively,you can check with count() function like this:-
if((count($myArray) < 1) || (count($myArray)) === 0){ echo 'Array is empty'; }else{ echo 'There is Data in Array'; } $myArray is variable, isn't it? Empty function works also for arrays: The following things are considered to be empty: array() (an empty array)