php数组是空的不行

I have a dynamically generated array. sometimes it's value is null, when it is null the browser gives an error. therefore I want to check if the array is empty. when array is empty i use

echo var_dump($myarray); 

then browser echoing following

i want to identify this kind of situation i use

  array(0) { } 

i try flowing method but it didn't work

$errors = array_filter($myarray);
if( !empty($errors)){
       //do 
}

also i try

if ($myarray==''){
 //not working
}

You don't have to use array_filter. You can simply check for array being empty this way:

if(empty($myarray)){
    // Code to execute when array is empty.
}
else {
    // Code to execute when array is not empty.
}

This will work for arrays and multidimensional arrays alike.

It also removes empty strings. such as [0] => ""

if (!array_filter($myarray) { 
    //If the array is empty
}

try this

$errors = array();

if(count($myarray)>0)
{
    $errors = array_filter($myarray);  
}

if(count($errors)>0)
{
    // do here !!
}