3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array=array("number"=>"3","string"=>"abc","null"=>null); $ncache=array(); $scache=array(); foreach(range(1,10000) as $it) { $ncache[]=$array; $scache[]=$array; } function ncompress(&$v) { if(is_numeric($v)) $v=floatval($v); elseif(is_string($v)) $v=trim($v); elseif(is_null($v)) $v=null; } function scompress(&$v) { if(is_numeric($v)) $v=floatval($v); elseif(is_string($v)) $v=trim($v); elseif(is_null($v)) $v=""; } array_walk_recursive($ncache,"ncompress"); array_walk_recursive($scache,"scompress"); echo "Length of null : ".strlen(json_encode($ncache).'('.strlen(deflate(json_encode($ncache)).')'); echo "\n"; echo "Length of string: ".strlen(json_encode($scache).'('.strlen(deflate(json_encode($scache)).')');
Output for 5.3.0 - 5.4.17
Parse error: syntax error, unexpected ';' in /in/de36r on line 24
Process exited with code 255.