3v4l.org

run code in 300+ PHP versions simultaneously
<?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.25, 5.4.17
Parse error: syntax error, unexpected ';' in /in/de36r on line 24
Process exited with code 255.
Output for 5.3.0 - 5.3.24, 5.3.26, 5.4.0 - 5.4.16
Parse error: syntax error, unexpected ';' in de36r on line 24
Process exited with code 255.

preferences:
189.1 ms | 1395 KiB | 52 Q