3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr =Array( 0 => Array ( 0 => "string", 1 => 1, "return" => true ), "two" => Array ( 0 => "2017-10-09", 1 => 248.38, "return" => false ), 3 => -123.4, 4 => array( 0 => array( 0 => "foo", 1 => array( 0 => "bar" ) ) ) ); printArray($arr // Input array for output , "array(" // type of output "array()" or "[]" , 1 // start padding multiplied with 4. 1 = 4 spaces indenting at start. , false // is input a subarray. Always false when you call the function. Only function itself should change this ); function printArray($arr, $output, $pad, $subarray){ // If it's a subarray don't indent "array" text if($subarray){ echo str_pad("", 0, " ") . $output ."\n"; }else{ echo str_pad("", $pad*4, " ") . $output ."\n"; } $i=1; foreach($arr as $key => $item){ if(is_array($item)){ echo str_pad("", ($pad+1)*4, " "); // add "" to key if it's associative if(is_string($key)){ echo "\"" . $key. "\" => "; }else{ echo $key . " => "; } // recrusive run printArray with padding +1 (more indenting) printArray($item, $output, $pad+1, true); }else{ echo str_pad("", ($pad+1)*4, " "); // add "" to key if it's associative if(is_string($key)){ echo "\"" . $key. "\""; }else{ echo $key; } // echo item with "" if it's string, or as bool or else as numeric (float/int) if(is_string($item)){ echo " => \"". $item ."\""; }else if(is_bool($item)){ $bool = var_export($item,true); echo " => ". $bool; }else{ echo " => ". $item; } // if it's the last item, don't add comma to end of array if($i == count($arr)){ echo "\n"; }else{ echo ",\n"; } $i++; } } // add correct closing bracket if($output == "["){ echo str_pad("", $pad*4, " ") . "]"; }else{ echo str_pad("", $pad*4, " ") . ")"; } // if it's the very last item add a ; instead of , if($pad == 1){ echo ";\n"; }else{ if($i == count($arr)){ echo "\n"; }else{ echo ",\n"; } } }

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)
8.5.10.0100.00816.80
8.5.00.0100.01120.13
8.4.150.0020.00014.05
8.4.140.0040.00517.60
8.4.130.0120.00917.71
8.4.120.0110.00920.51
8.4.110.0070.01222.38
8.4.100.0100.00717.57
8.4.90.0030.00618.96
8.4.80.0060.00317.75
8.4.70.0080.00617.89
8.4.60.0140.00717.89
8.4.50.0040.00418.71
8.4.40.0180.00417.48
8.4.30.0000.01017.60
8.4.20.0030.00619.41
8.4.10.0060.00617.66
8.3.280.0130.00718.38
8.3.270.0140.00716.38
8.3.260.0140.00616.52
8.3.250.0120.00618.79
8.3.240.0100.00416.80
8.3.230.0130.00716.68
8.3.220.0130.00517.05
8.3.210.0080.00816.49
8.3.200.0050.00416.49
8.3.190.0110.00918.89
8.3.180.0120.00716.75
8.3.170.0080.00018.25
8.3.160.0070.00416.49
8.3.150.0110.00719.10
8.3.140.0070.01118.20
8.3.130.0090.00018.58
8.3.120.0040.00420.81
8.3.110.0150.00020.94
8.3.100.0050.00324.06
8.3.90.0040.00426.77
8.3.80.0060.00317.97
8.3.70.0110.00716.38
8.3.60.0150.00418.29
8.3.50.0200.00217.40
8.3.40.0070.00718.71
8.3.30.0120.00318.54
8.3.20.0040.00420.16
8.3.10.0060.00322.09
8.3.00.0080.00023.66
8.2.290.0120.00620.36
8.2.280.0100.00518.52
8.2.270.0130.00716.75
8.2.260.0070.00718.86
8.2.250.0110.00418.40
8.2.240.0080.00018.73
8.2.230.0050.00522.58
8.2.220.0070.00337.54
8.2.210.0090.00926.77
8.2.200.0090.00018.16
8.2.190.0000.01516.74
8.2.180.0110.01116.75
8.2.170.0040.01122.96
8.2.160.0000.01422.13
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0070.00020.35
8.2.120.0040.00426.35
8.2.110.0000.00920.89
8.2.100.0090.00317.91
8.2.90.0050.00320.42
8.2.80.0030.00617.97
8.2.70.0060.00317.92
8.2.60.0000.00918.03
8.2.50.0000.01318.10
8.2.40.0050.00320.54
8.2.30.0000.00819.35
8.2.20.0000.00918.05
8.2.10.0000.00818.18
8.2.00.0040.00418.16
8.1.330.0130.00623.66
8.1.320.0090.01016.35
8.1.310.0130.00718.36
8.1.300.0050.00516.29
8.1.290.0090.00030.84
8.1.280.0110.00425.92
8.1.270.0040.00420.36
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00322.49
8.1.230.0060.00620.88
8.1.220.0000.00817.74
8.1.210.0090.00018.89
8.1.200.0080.00017.35
8.1.190.0090.00017.23
8.1.180.0080.00018.10
8.1.170.0030.00620.72
8.1.160.0040.00418.98
8.1.150.0000.00720.14
8.1.140.0040.00417.66
8.1.130.0000.00719.05
8.1.120.0040.00417.53
8.1.110.0000.00917.55
8.1.100.0040.00417.41
8.1.90.0030.00617.39
8.1.80.0080.00017.44
8.1.70.0000.00717.35
8.1.60.0030.00617.62
8.1.50.0080.00017.50
8.1.40.0040.00417.57
8.1.30.0030.00517.69
8.1.20.0030.00617.63
8.1.10.0000.00817.43
8.1.00.0080.00017.46
8.0.300.0050.00320.15
8.0.290.0040.00416.75
8.0.280.0040.00418.50
8.0.270.0000.00817.97
8.0.260.0000.00718.46
8.0.250.0030.00617.02
8.0.240.0040.00416.88
8.0.230.0030.00317.00
8.0.220.0000.00716.95
8.0.210.0000.00716.82
8.0.200.0040.00416.89
8.0.190.0040.00716.97
8.0.180.0040.00416.84
8.0.170.0000.00817.01
8.0.160.0000.00816.97
8.0.150.0100.00016.95
8.0.140.0000.00716.89
8.0.130.0030.00313.45
8.0.120.0080.00316.93
8.0.110.0040.00416.93
8.0.100.0000.00816.86
8.0.90.0040.00416.79
8.0.80.0000.01617.00
8.0.70.0040.00416.80
8.0.60.0000.00816.81
8.0.50.0040.00416.93
8.0.30.0080.01017.10
8.0.20.0120.00817.40
8.0.10.0000.00816.86
8.0.00.0060.01716.84
7.4.330.0030.00315.55
7.4.320.0070.00016.65
7.4.300.0060.00016.50
7.4.290.0100.00016.46
7.4.280.0070.00016.63
7.4.270.0070.00016.50
7.4.260.0000.00716.55
7.4.250.0000.00716.51
7.4.240.0050.00316.42
7.4.230.0000.00816.50
7.4.220.0100.00716.68
7.4.210.0130.00616.52
7.4.200.0040.00416.65
7.4.160.0120.00516.53
7.4.150.0110.00717.40
7.4.140.0110.01017.86
7.4.130.0160.00316.52
7.4.120.0120.00816.52
7.4.110.0110.00716.56
7.4.100.0070.01616.43
7.4.90.0060.01216.53
7.4.80.0040.01819.39
7.4.70.0070.01116.46
7.4.60.0070.01116.61
7.4.50.0070.00316.71
7.4.40.0150.00316.64
7.4.30.0060.01016.47
7.4.00.0130.00315.10
7.3.330.0060.00313.18
7.3.320.0060.00013.36
7.3.310.0070.00016.32
7.3.300.0040.00416.24
7.3.290.0100.00316.36
7.3.280.0080.00816.34
7.3.270.0070.01117.40
7.3.260.0160.00816.44
7.3.250.0110.00616.46
7.3.240.0070.01216.43
7.3.230.0100.01016.59
7.3.210.0090.01216.42
7.3.200.0170.00316.37
7.3.190.0060.01016.38
7.3.180.0080.00816.58
7.3.170.0070.01016.48
7.3.160.0080.00816.53
7.2.330.0160.00316.75
7.2.320.0170.00716.70
7.2.310.0090.00916.52
7.2.300.0150.00716.76
7.2.290.0160.00416.59
7.2.60.0000.01616.75
7.1.200.0100.00615.46
7.1.100.4090.01015.96
7.1.90.4290.01016.24
7.1.80.4890.01016.03
7.1.70.4790.01015.44
7.1.60.5150.01033.25
7.1.50.0430.01033.09
7.1.40.0240.00932.71
7.1.30.0240.02032.65
7.1.20.0230.01332.80
7.1.10.0150.00715.05
7.1.00.4130.00715.07
7.0.240.4310.01615.83
7.0.230.4930.00715.70
7.0.220.4450.01015.67
7.0.210.5100.00714.95
7.0.200.4310.00715.07
7.0.190.0060.00914.86
7.0.180.0040.01314.50
7.0.170.0050.01314.49
7.0.160.0080.01314.39
7.0.150.3050.01014.52
7.0.140.4290.01014.52
7.0.130.4060.01314.66
7.0.120.3530.01014.66
7.0.110.3790.01014.67
7.0.100.4180.01014.55
7.0.90.3680.01014.50
7.0.80.3020.00714.60
7.0.70.2350.00314.33
7.0.60.2030.00314.27
7.0.50.2280.00314.65
7.0.40.2570.00314.78
7.0.30.2850.01314.85
7.0.20.2460.01014.71
7.0.10.3700.00714.61
7.0.00.3680.00314.55

preferences:
162.41 ms | 403 KiB | 5 Q