3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php class Foo { public $bar = 'barValue'; protected $baz = 'bazValue'; private $biz = 'bizValue'; } $foo = new Foo(); $arrayFoo = (array) $foo; $out = var_export($arrayFoo, true); $out = preg_replace('/\'\' . "\\\0\" . \'[*a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\' . "\\\0\" . /', '', $out); $newArray = unvar_dump($out); var_dump($newArray); function unvar_dump($str) { if (strpos($str, "\n") === false) { //Add new lines: $regex = array( '#(\\[.*?\\]=>)#', '#(string\\(|int\\(|float\\(|array\\(|NULL|object\\(|})#', ); $str = preg_replace($regex, "\n\\1", $str); $str = trim($str); } $regex = array( '#^\\040*NULL\\040*$#m', '#^\\s*array\\((.*?)\\)\\s*{\\s*$#m', '#^\\s*string\\((.*?)\\)\\s*(.*?)$#m', '#^\\s*int\\((.*?)\\)\\s*$#m', '#^\\s*float\\((.*?)\\)\\s*$#m', '#^\\s*\[(\\d+)\\]\\s*=>\\s*$#m', '#\\s*?\\r?\\n\\s*#m', ); $replace = array( 'N', 'a:\\1:{', 's:\\1:\\2', 'i:\\1', 'd:\\1', 'i:\\1', ';' ); $serialized = preg_replace($regex, $replace, $str); $func = create_function( '$match', 'return "s:".strlen($match[1]).":\\"".$match[1]."\\"";' ); $serialized = preg_replace_callback( '#\\s*\\["(.*?)"\\]\\s*=>#', $func, $serialized ); $func = create_function( '$match', 'return "O:".strlen($match[1]).":\\"".$match[1]."\\":".$match[2].":{";' ); $serialized = preg_replace_callback( '#object\\((.*?)\\).*?\\((\\d+)\\)\\s*{\\s*;#', $func, $serialized ); $serialized = preg_replace( array('#};#', '#{;#'), array('}', '{'), $serialized ); return unserialize($serialized); } //"a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff"; // '' . "\0" . '*' . "\0" . //echo $out . PHP_EOL; //$b = serialize(array('bar' => 'barValue', 'baz' => 'bazValue', 'biz' => 'bizValue')); //echo $b . PHP_EOL;

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.170.0110.03812.38
5.4.160.0100.03912.38
5.4.150.0120.03612.37
5.4.140.0110.03812.06
5.4.130.0080.04012.04
5.4.120.0120.03412.01
5.4.110.0090.03812.00
5.4.100.0090.03912.01
5.4.90.0100.03912.00
5.4.80.0090.04012.00
5.4.70.0080.03912.00
5.4.60.0120.04012.00
5.4.50.0110.04112.00
5.4.40.0110.04111.99
5.4.30.0090.04011.98
5.4.20.0090.03811.98
5.4.10.0100.03611.98
5.4.00.0090.03811.48
5.3.270.0120.04212.72
5.3.260.0090.04512.72
5.3.250.0110.03912.72
5.3.240.0090.04112.72
5.3.230.0110.04012.71
5.3.220.0080.04312.68
5.3.210.0100.04012.68
5.3.200.0090.04212.68
5.3.190.0100.04112.67
5.3.180.0110.03812.67
5.3.170.0110.03912.67
5.3.160.0080.04212.67
5.3.150.0090.04212.68
5.3.140.0100.04012.66
5.3.130.0100.04512.66
5.3.120.0120.04012.66
5.3.110.0080.04312.66
5.3.100.0110.04212.12
5.3.90.0120.04412.08
5.3.80.0100.04012.08
5.3.70.0090.04012.08
5.3.60.0070.04212.06
5.3.50.0100.03912.00
5.3.40.0120.03812.00
5.3.30.0110.04111.95
5.3.20.0090.04411.73
5.3.10.0100.04011.69
5.3.00.0090.04311.68

preferences:
140.2 ms | 1399 KiB | 7 Q