3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $lules = array( 'dsf1sdfd' => '', 'sdfd2sffffff' => 0, 'dfsdf3sdfefd' => 'fdsf', 'dsfsdf4d' => '', 'sdfdsff5ffff' => 0, 'dfsdfsdf6efd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', ); $rules = array( 'dsf1sdfd' => '', 'sdfd2sffffff' => 0, 'dfsdf3sdfefd' => 'fdsf', 'dsfsdf4d' => '', 'sdfdsff5ffff' => 0, 'dfsdfsdf6efd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', 'dsfsdfd' => '', 'sdfdsffffff' => 0, 'dfsdfsdfefd' => 'fdsf', ); $time = time(); foreach($lules as $key => $value) { if(empty($value)) { unset($lules[$key]); } } $time1 = time(); echo $time1 - $time; var_dump($lules); $time0 = time(); $bules = array_filter(&$rules); $time2 = time(); echo $time2 - $time0; var_dump($bules); var_dump($rules);
based on hMJju
Output for 7.0.0
Parse error: syntax error, unexpected '&' in /in/4NNDn on line 78
Process exited with code 255.
Output for 5.4.10 - 5.6.16
Fatal error: Call-time pass-by-reference has been removed in /in/4NNDn on line 78
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Deprecated: Call-time pass-by-reference has been deprecated in /in/4NNDn on line 78 0array(3) { ["dfsdf3sdfefd"]=> string(4) "fdsf" ["dfsdfsdf6efd"]=> string(4) "fdsf" ["dfsdfsdfefd"]=> string(4) "fdsf" } 0array(3) { ["dfsdf3sdfefd"]=> string(4) "fdsf" ["dfsdfsdf6efd"]=> string(4) "fdsf" ["dfsdfsdfefd"]=> string(4) "fdsf" } array(9) { ["dsf1sdfd"]=> string(0) "" ["sdfd2sffffff"]=> int(0) ["dfsdf3sdfefd"]=> string(4) "fdsf" ["dsfsdf4d"]=> string(0) "" ["sdfdsff5ffff"]=> int(0) ["dfsdfsdf6efd"]=> string(4) "fdsf" ["dsfsdfd"]=> string(0) "" ["sdfdsffffff"]=> int(0) ["dfsdfsdfefd"]=> string(4) "fdsf" }