3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array ( 0 => array ( 'php' => 5.3, ), 1 => array ( 'php' => 5.3, ), 2 => array ( 'php' => 5.3, ), ); $t = microtime(true); for ($i = 0; $i < 1000000; $i++) { $a = array_map('serialize', $a); $a = array_unique($a); $a = array_map('unserialize', $a); } echo 'serialize'; var_dump($a); echo microtime(true) - $t."\n"; $t = microtime(true); for ($i = 0; $i < 1000000; $i++) { $a = array_map('json_encode', $a); $a = array_unique($a); $a = array_map(function($v) { return json_decode($v, true);}, $a); } echo 'json'; var_dump($a); echo microtime(true) - $t."\n";
Output for 7.1.0
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 0.78090596199036 jsonarray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 1.0611658096313
Output for 7.0.14
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 1.2734310626984 jsonarray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 1.0831182003021
Output for 7.0.10
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 1.5849859714508
Process exited with code 137.
Output for 7.0.9
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 1.341649055481 jsonarray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 0.7796630859375
Output for 7.0.8
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 1.2761449813843 jsonarray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 0.78587102890015
Output for 7.0.7
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 1.2829229831696 jsonarray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 0.78633904457092
Output for 7.0.6
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 1.3309938907623 jsonarray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 0.79452896118164
Output for 7.0.5
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 1.585098028183
Process exited with code 137.
Output for 7.0.4
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 1.3956179618835 jsonarray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 0.79366397857666
Output for 7.0.3
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 1.4320268630981 jsonarray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 0.77802920341492
Output for 7.0.2
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 1.2852640151978 jsonarray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 0.78351092338562
Output for 7.0.1
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 1.4159820079803 jsonarray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 0.8047571182251
Output for 7.0.0
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 1.3608069419861 jsonarray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 0.78804612159729
Output for 5.3.0 - 5.6.12, 5.6.14 - 5.6.17, 5.6.19 - 5.6.24, 5.6.28, hhvm-3.10.0 - 3.12.0

Process exited with code 137.
Output for 5.6.25
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 2.4160089492798
Process exited with code 137.
Output for 5.6.18
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 2.4357619285583
Process exited with code 137.
Output for 5.6.13
serializearray(1) { [0]=> array(1) { ["php"]=> float(5.3) } } 2.4508309364319
Process exited with code 137.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/djIlG on line 31
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/djIlG on line 31
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/djIlG on line 31
Process exited with code 255.