I have an array of zeros like this:
$a = array(0 , 0 , 0 , 0 );
I want an if statement that is about like this:
if ($a == 0){
//do something;
}else{
//do not do something!!!;
How can it be possible? with foreach? how? i think the answer is this:
$size = sizeof($a);
for($i=0 ; $i < $size ; $i++){
if( $a[$i] != 0){
break;
}else{
//do something
}
but for a big array i think it may fags the CPU is there other way?
Aucun commentaire:
Enregistrer un commentaire