3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array1 = array('one','two','three'); $array2 = array(); $array3 = array ('four'); $array4 = array ('five','six'); check([&$array1,&$array2,&$array3,&$array4]); function check($arr){ foreach ($arr as $k=>$value) { if(empty($value) == false){ $arr[$k] = "nothing"; return $arr[$k]; } else{ return $arr[$k]; } } } var_dump($array2); //actual output : empty //expect output : 0 => string 'nothing' ?>
Output for 5.5.0 - 7.3.0beta1
array(0) { }