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(gzdeflate(json_encode($ncache))).')' .' ('.strlen(gzencode(json_encode($ncache),9)).')'; echo "\n"; echo "Length of string: ".strlen(json_encode($scache)) .' ('.strlen(gzdeflate(json_encode($scache))).')' .' ('.strlen(gzencode(json_encode($scache),9)).')';

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.3.60.0070.05628.32
8.3.50.0140.05627.20
8.3.40.0260.03929.46
8.3.30.0270.04329.42
8.3.20.0100.02329.23
8.3.10.0030.02431.00
8.3.00.0100.02332.35
8.2.180.0220.03527.13
8.2.170.0100.05029.70
8.2.160.0130.04631.02
8.2.150.0060.02929.93
8.2.140.0100.02330.85
8.2.130.0100.01732.31
8.2.120.0070.02231.18
8.2.110.0070.03831.41
8.2.100.0170.03028.47
8.2.90.0100.02828.72
8.2.80.0100.03028.25
8.2.70.0100.03028.55
8.2.60.0100.02928.66
8.2.50.0030.03628.79
8.2.40.0070.03331.77
8.2.30.0060.03230.55
8.2.20.0030.03728.45
8.2.10.0070.03128.52
8.2.00.0030.04728.52
8.1.280.0140.05430.88
8.1.270.0070.02633.07
8.1.260.0180.01531.50
8.1.250.0030.02434.24
8.1.240.0130.03733.58
8.1.230.0130.03232.03
8.1.220.0100.02928.90
8.1.210.0130.02629.97
8.1.200.0070.03328.35
8.1.190.0070.03428.35
8.1.180.0060.03228.38
8.1.170.0000.04029.84
8.1.160.0160.02930.14
8.1.150.0100.03129.87
8.1.140.0030.03528.64
8.1.130.0070.03028.99
8.1.120.0090.02828.70
8.1.110.0090.02828.55
8.1.100.0070.03028.69
8.1.90.0000.03928.58
8.1.80.0030.03428.54
8.1.70.0000.03728.68
8.1.60.0030.04828.78
8.1.50.0070.04028.67
8.1.40.0070.03828.75
8.1.30.0070.03928.75
8.1.20.0000.04728.73
8.1.10.0030.04328.63
8.1.00.0140.03428.52
8.0.300.0130.02830.79
8.0.290.0070.03327.63
8.0.280.0120.02829.45
8.0.270.0100.03028.32
8.0.260.0000.03727.78
8.0.250.0030.03727.91
8.0.240.0070.04427.97
8.0.230.0070.03227.80
8.0.220.0060.03327.86
8.0.210.0160.02527.73
8.0.200.0030.03727.93
8.0.190.0070.03827.87
8.0.180.0070.03827.83
8.0.170.0060.03927.81
8.0.160.0060.03927.76
8.0.150.0030.04227.71
8.0.140.0030.04727.86
8.0.130.0030.04024.40
8.0.120.0070.03927.78
8.0.110.0060.03827.65
8.0.100.0100.03627.85
8.0.90.0060.03927.83
8.0.80.0160.05527.79
8.0.70.0060.03827.65
8.0.60.0070.04027.64
8.0.50.0130.03327.81
8.0.30.0220.05728.11
8.0.20.0160.07127.89
8.0.10.0100.03627.98
8.0.00.0200.06227.70
7.4.330.0030.02928.81
7.4.320.0070.03127.40
7.4.300.0070.02827.41
7.4.290.0030.04027.42
7.4.280.0100.03627.26
7.4.270.0100.03627.46
7.4.260.0030.04024.22
7.4.250.0100.03727.43
7.4.240.0000.04527.30
7.4.230.0070.03827.47
7.4.220.0400.10627.36
7.4.210.0140.05627.38
7.4.200.0030.04127.26
7.4.190.0000.04527.26
7.4.160.0270.05127.43
7.4.150.0210.05027.34
7.4.140.0270.04827.36
7.4.130.0230.06127.58
7.4.120.0130.06027.46
7.4.110.0260.05327.35
7.4.100.0230.07027.59
7.4.90.0140.06527.48
7.4.80.0140.06827.41
7.4.70.0150.07127.33
7.4.60.0230.05627.31
7.4.50.0060.04827.45
7.4.40.0070.05827.58
7.4.30.0330.05327.47
7.4.00.0070.06425.99
7.3.330.0030.03923.58
7.3.320.0100.04523.50
7.3.310.0070.03826.38
7.3.300.0100.03326.64
7.3.290.0220.06926.70
7.3.280.0180.07526.58
7.3.270.0200.11126.69
7.3.260.0230.07326.81
7.3.250.0180.07926.72
7.3.240.0200.05326.70
7.3.230.0240.05026.85
7.3.210.0190.05626.70
7.3.200.0200.08826.64
7.3.190.0100.07326.66
7.3.180.0200.06326.56
7.3.170.0130.06626.68
7.3.160.0120.07126.68
7.3.120.0030.05825.13
7.3.10.0180.04926.65
7.3.00.0130.05226.71
7.2.330.0130.06627.19
7.2.320.0140.06827.15
7.2.310.0270.06927.41
7.2.300.0160.08327.36
7.2.290.0260.05527.15
7.2.130.0120.06127.21
7.2.120.0220.05126.91
7.2.110.0250.05726.87
7.2.100.0200.05527.10
7.2.90.0140.05927.05
7.2.80.0210.05726.95
7.2.70.0200.05727.17
7.2.60.0260.05127.06
7.2.50.0250.05726.90
7.2.40.0200.05727.18
7.2.30.0140.05827.06
7.2.20.0270.04826.99
7.2.10.0240.05626.97
7.2.00.0180.05328.02
7.1.250.0180.05726.13
7.1.200.0180.03525.95
7.1.100.0060.04227.88
7.1.70.0070.05327.31
7.1.60.0000.04327.64
7.1.50.0290.06245.18
7.1.00.0070.11032.69
7.0.200.1810.04024.30
7.0.140.0030.12729.98
7.0.90.0200.10029.72
7.0.80.1230.09029.75
7.0.70.2400.10329.82
7.0.60.2630.11329.74
7.0.50.2470.10330.10
7.0.40.0100.12319.98
7.0.30.0030.07720.09
7.0.20.0070.07319.96
7.0.10.0070.06720.07
7.0.00.0070.07020.09
5.6.280.0130.18736.18
5.6.240.0170.17336.07
5.6.230.0130.16736.16
5.6.220.0100.12035.89
5.6.210.0130.13035.96
5.6.200.0070.18336.55
5.6.190.0130.15036.46
5.6.180.0170.16336.49
5.6.170.0100.13736.43
5.6.160.0030.13736.49
5.6.150.0100.14336.45
5.6.140.0200.11036.41
5.6.130.0200.16036.59
5.6.120.0100.16736.46
5.6.110.0130.19336.51
5.6.100.0070.14036.50
5.6.90.0130.13336.49
5.6.80.0100.14035.88
5.6.70.0100.19035.81
5.6.60.0200.11035.82
5.6.50.0030.15735.73
5.6.40.0230.17735.73
5.6.30.0030.18735.82
5.6.20.0270.16035.71
5.6.10.0070.13335.70
5.6.00.0100.14735.81
5.5.380.0230.13035.79
5.5.370.0230.16735.90
5.5.360.0070.18735.76
5.5.350.0230.15335.78
5.5.340.0130.17036.21
5.5.330.0330.17036.24
5.5.320.0130.12036.17
5.5.310.0030.12736.17
5.5.300.0100.14036.05
5.5.290.0230.15336.18
5.5.280.0000.14336.21
5.5.270.0100.17736.32
5.5.260.0100.17336.29
5.5.250.0130.15735.99
5.5.240.0130.13736.02
5.5.230.0170.11335.59
5.5.220.0130.17335.66
5.5.210.0130.17735.65
5.5.200.0130.18335.38
5.5.190.0070.17335.65
5.5.180.0030.12735.50
5.5.160.0030.14035.54
5.5.150.0230.18735.55
5.5.140.0170.14035.53
5.5.130.0130.16735.64
5.5.120.0400.11035.64
5.5.110.0030.16335.53
5.5.100.0130.13735.49
5.5.90.0200.16335.45
5.5.80.0070.12735.41
5.5.70.0170.12735.34
5.5.60.0170.16335.50
5.5.50.0170.15335.46
5.5.40.0170.14335.46
5.5.30.0200.14735.50
5.5.20.0130.10335.45
5.5.10.0130.17335.46
5.5.00.0230.17735.45
5.4.450.0030.12334.69
5.4.440.0100.17734.64
5.4.430.0200.12034.88
5.4.420.0100.17334.67
5.4.410.0100.18034.57
5.4.400.0100.15034.56
5.4.390.0270.17734.41
5.4.380.0100.17334.76
5.4.370.0100.19034.30
5.4.360.0100.11734.52
5.4.350.0170.19034.39
5.4.340.0200.17334.45
5.4.320.0030.19334.23
5.4.310.0170.13034.65
5.4.300.0100.18734.48
5.4.290.0200.11734.37
5.4.280.0130.13334.37
5.4.270.0130.16334.27
5.4.260.0130.15334.70
5.4.250.0070.13334.89
5.4.240.0000.13034.43
5.4.230.0170.15034.39
5.4.220.0030.15334.22
5.4.210.0200.14734.40
5.4.200.0170.14334.29
5.4.190.0130.16334.38
5.4.180.0230.17334.49
5.4.170.0130.11734.24
5.4.160.0100.17334.39
5.4.150.0070.12034.44
5.4.140.0100.14731.69
5.4.130.0130.16031.70
5.4.120.0170.17031.64
5.4.110.0300.16731.82
5.4.100.0130.14031.73
5.4.90.0100.14732.12
5.4.80.0070.13731.69
5.4.70.0130.13731.70
5.4.60.0270.14331.82
5.4.50.0030.14731.71
5.4.40.0100.12031.82
5.4.30.0100.13031.73
5.4.20.0030.14731.70
5.4.10.0070.16031.82
5.4.00.0070.11731.21
5.3.290.0100.15730.80
5.3.280.0100.16730.76
5.3.270.0170.12730.77
5.3.260.0100.18730.81
5.3.250.0130.17331.16
5.3.240.0130.13330.72
5.3.230.0200.11030.66
5.3.220.0100.12030.77
5.3.210.0170.13730.62
5.3.200.0270.16030.66
5.3.190.0070.16730.68
5.3.180.0070.15030.76
5.3.170.0070.14030.70
5.3.160.0170.16330.76
5.3.150.0200.19030.57
5.3.140.0070.13331.01
5.3.130.0100.12730.57
5.3.120.0170.13330.56
5.3.110.0100.13730.61
5.3.100.0170.12030.20
5.3.90.0230.11030.22
5.3.80.0270.10030.08
5.3.70.0170.12730.18
5.3.60.0130.13029.95
5.3.50.0000.20730.12
5.3.40.0000.13330.04
5.3.30.0200.10730.02
5.3.20.0100.12329.77
5.3.10.0130.12329.69
5.3.00.0170.11729.63
5.2.170.0070.12026.51
5.2.160.0070.18026.59
5.2.150.0030.12326.46
5.2.140.0100.15326.66
5.2.130.0070.12026.46
5.2.120.0130.10326.70
5.2.110.0070.12326.64
5.2.100.0070.12026.96
5.2.90.0030.12326.64
5.2.80.0000.12726.41
5.2.70.0070.12726.46
5.2.60.0030.14026.54
5.2.50.0200.12026.38
5.2.40.0070.17726.31
5.2.30.0070.13026.51
5.2.20.0130.11726.46
5.2.10.0100.10326.40
5.2.00.0100.13026.38
5.1.60.0100.08328.92
5.1.50.0130.12728.69
5.1.40.0030.09328.80
5.1.30.0030.14329.19
5.1.20.0100.11729.25
5.1.10.0100.12328.98
5.1.00.0170.10728.94
5.0.50.0000.12312.56
5.0.40.0000.07712.30
5.0.30.0070.08712.23
5.0.20.0100.12012.29
5.0.10.0030.08712.19
5.0.00.0070.06712.18
4.4.90.0000.02710.01
4.4.80.0070.01310.00
4.4.70.0000.0209.93
4.4.60.0070.01710.04
4.4.50.0070.02010.02
4.4.40.0000.05310.00
4.4.30.0100.02710.02
4.4.20.0030.0409.99
4.4.10.0030.02310.10
4.4.00.0000.0709.99
4.3.110.0000.0279.88
4.3.100.0030.0439.96
4.3.90.0070.0279.90
4.3.80.0130.0539.91
4.3.70.0070.0409.88
4.3.60.0100.0339.81
4.3.50.0030.0439.85
4.3.40.0070.0539.80
4.3.30.0000.0408.68
4.3.20.0030.0508.65
4.3.10.0000.0308.54
4.3.00.0000.0278.64

preferences:
45.58 ms | 401 KiB | 5 Q