3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set( 'display_errors', 1 ); error_reporting( E_ALL ); // Make a bit, honkin test array // You may need to adjust this depth to avoid memory limit errors $testArray = fillArray( 0, 5 ); // Time json encoding $start = microtime( true ); json_encode( $testArray ); $jsonTime = microtime( true ) - $start; echo "JSON encoded in $jsonTime seconds<br>"; // Time serialization $start = microtime( true ); serialize( $testArray ); $serializeTime = microtime( true ) - $start; echo "PHP serialized in $serializeTime seconds<br>"; // Compare them if ( $jsonTime < $serializeTime ) { echo "json_encode() was roughly " . number_format( ($serializeTime / $jsonTime - 1 ) * 100, 2 ) . "% faster than serialize()"; } else if ( $serializeTime < $jsonTime ) { echo "serialize() was roughly " . number_format( ($jsonTime / $serializeTime - 1 ) * 100, 2 ) . "% faster than json_encode()"; } else { echo 'Unpossible!'; } function fillArray( $depth, $max ) { static $seed; if ( is_null( $seed ) ) { $seed = array( 'a', 2, 'c', 4, 'e', 6, 'g', 8, 'i', 10 ); } if ( $depth < $max ) { $node = array(); foreach ( $seed as $key ) { $node[$key] = fillArray( $depth + 1, $max ); } return $node; } return 'empty'; }

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.40.0250.02827.95
8.3.30.0400.02628.26
8.3.20.0210.02931.35
8.3.10.0150.03631.27
8.3.00.0240.02828.42
8.2.170.0340.02028.27
8.2.160.0160.04129.40
8.2.150.0260.02828.55
8.2.140.0160.03929.66
8.2.130.0200.03029.42
8.2.120.0200.03928.77
8.2.110.0210.02429.27
8.2.100.0270.02628.16
8.2.90.0270.02427.74
8.2.80.0280.02027.76
8.2.70.0230.02142.37
8.2.60.0180.01927.25
8.2.50.0240.02127.39
8.2.40.0260.01727.50
8.2.30.0240.01927.48
8.2.20.0230.01927.36
8.2.10.0190.02227.38
8.2.00.0190.02327.32
8.1.270.0190.02931.92
8.1.260.0190.02631.67
8.1.250.0190.02831.74
8.1.240.0240.02228.21
8.1.230.0250.02227.35
8.1.220.0190.02727.66
8.1.210.0190.02727.92
8.1.200.0260.02327.44
8.1.190.0230.02027.08
8.1.180.0260.02027.21
8.1.170.0170.02727.35
8.1.160.0200.02227.26
8.1.150.0220.02227.30
8.1.140.0230.02227.26
8.1.130.0190.02427.44
8.1.120.0140.02227.18
8.1.110.0200.02227.20
8.1.100.0200.02127.59
8.1.90.0200.02327.25
8.1.80.0180.01927.29
8.1.70.0200.01927.24
8.1.60.0190.02427.42
8.1.50.0190.02127.30
8.1.40.0210.02127.32
8.1.30.0210.02127.36
8.1.20.0220.02027.65
8.1.10.0220.01827.33
8.1.00.0170.02127.22
8.0.300.0230.02226.54
8.0.290.0260.02326.50
8.0.280.0230.02426.31
8.0.270.0230.02226.40
8.0.260.0250.02226.36
8.0.250.0230.02126.34
8.0.240.0230.02226.38
8.0.230.0190.02626.35
8.0.220.0220.02326.29
8.0.210.0210.02326.32
8.0.200.0200.02526.32
8.0.190.0190.02626.31
8.0.180.0180.02626.34
8.0.170.0160.02726.31
8.0.160.0200.02126.34
8.0.150.0200.02326.27
8.0.140.0210.02526.31
8.0.130.0210.02026.22
8.0.120.0170.02526.24
8.0.110.0210.01926.17
8.0.100.0190.02426.23
8.0.90.0220.02326.19
8.0.80.0220.02026.28
8.0.70.0200.02026.26
8.0.60.0210.02226.17
8.0.50.0240.01826.17
8.0.30.0220.03026.21
8.0.20.0250.03126.27
8.0.10.0240.03026.30
8.0.00.0220.03126.57
7.4.330.0150.02022.63
7.4.320.0260.02125.89
7.4.300.0240.01925.89
7.4.290.0230.02125.85
7.4.280.0230.02325.84
7.4.270.0220.02425.85
7.4.260.0230.02225.85
7.4.250.0130.02223.97
7.4.240.0210.02225.89
7.4.230.0230.02025.95
7.4.220.0230.02025.82
7.4.210.0220.02225.82
7.4.200.0230.02225.81
7.4.190.0250.01925.96
7.4.180.0230.02225.95
7.4.160.0250.03025.84
7.4.150.0260.02925.83
7.4.140.0230.03025.70
7.4.130.0260.03025.76
7.4.120.0240.02925.70
7.4.110.0210.03325.73
7.4.100.0210.03225.79
7.4.90.0220.03425.77
7.4.80.0240.02925.76
7.4.70.0230.03125.79
7.4.60.0240.03125.78
7.4.50.0240.03325.73
7.4.40.0200.03525.69
7.4.30.0230.03025.73
7.4.20.0230.03025.75
7.4.10.0240.02925.68
7.4.00.0180.03425.53
7.3.330.0170.02325.78
7.3.320.0230.01925.76
7.3.310.0240.01825.70
7.3.300.0220.01925.79
7.3.290.0230.02025.77
7.3.280.0230.02925.67
7.3.270.0230.03025.73
7.3.260.0220.03125.67
7.3.250.0230.02925.69
7.3.240.0220.03025.69
7.3.230.0230.03125.74
7.3.220.0270.02925.68
7.3.210.0230.03125.60
7.3.200.0240.02825.64
7.3.190.0250.03225.61
7.3.180.0220.03525.67
7.3.170.0270.03125.73
7.3.160.0260.03025.60
7.3.150.0240.03125.63
7.3.140.0220.03525.61
7.3.130.0220.03325.57
7.3.120.0230.03325.53
7.3.110.0230.03425.52
7.3.100.0240.03125.44
7.3.90.0220.03325.64
7.3.80.0220.03025.48
7.3.70.0220.03225.65
7.3.60.0220.03325.41
7.3.50.0220.02925.30
7.3.40.0220.03025.30
7.3.30.0220.03125.28
7.3.20.0920.02925.37
7.3.10.1240.03225.25
7.3.00.1560.02925.25
7.2.340.0250.03125.80
7.2.330.0260.03425.71
7.2.320.0230.03325.75
7.2.310.0240.03725.73
7.2.300.0250.03325.74
7.2.290.0280.03025.74
7.2.280.0250.03325.77
7.2.270.0220.03925.78
7.2.260.0250.03425.74
7.2.250.0250.03725.65
7.2.240.0240.03425.73
7.2.230.0230.03625.72
7.2.220.0230.03625.69
7.2.210.0220.03525.73
7.2.200.0250.03325.85
7.2.190.0230.03525.58
7.2.180.0220.03325.47
7.2.170.0230.03025.52
7.2.160.0230.03225.44
7.2.150.0900.03225.57
7.2.140.1030.03125.63
7.2.130.1480.03425.52
7.2.120.1490.03425.50
7.2.110.1490.03425.51
7.2.100.1630.03125.53
7.2.90.1780.03025.44
7.2.80.1660.03225.48
7.2.70.1920.03425.47
7.2.60.2140.03425.42
7.2.50.2040.03125.36
7.2.40.1410.03325.47
7.2.30.1690.03225.50
7.2.20.1500.03325.50
7.2.10.1530.03225.49
7.2.00.1560.03225.48
7.1.330.0290.03525.01
7.1.320.0270.03624.97
7.1.310.0350.03325.00
7.1.300.0300.03324.81
7.1.290.0330.03324.83
7.1.280.0360.03424.72
7.1.270.0750.03624.74
7.1.260.0780.03624.66
7.1.250.1470.03724.41
7.1.240.1410.03824.45
7.1.230.1500.03424.41
7.1.220.1580.03624.46
7.1.210.1690.03524.46
7.1.200.1850.03524.50
7.1.190.1850.03524.41
7.1.180.1950.03424.34
7.1.170.1420.03224.35
7.1.160.1420.03524.46
7.1.150.1530.03724.46
7.1.140.1520.03524.47
7.1.130.1690.03424.47
7.1.120.1580.03424.46
7.1.110.1800.03624.46
7.1.100.1870.03424.44
7.1.90.1390.03424.47
7.1.80.1380.03324.48
7.1.70.1200.03424.40
7.1.60.1270.03525.88
7.1.50.1320.03625.94
7.1.40.1290.03825.89
7.1.30.1200.03525.92
7.1.20.1120.03625.90
7.1.10.1170.03424.45
7.1.00.1040.03624.35
7.0.330.1200.03724.40
7.0.320.1770.03624.42
7.0.310.1410.03924.44
7.0.300.1590.03724.42
7.0.290.1700.03724.46
7.0.280.1300.03924.50
7.0.270.1560.03924.46
7.0.260.1590.04324.51
7.0.250.2050.04024.53
7.0.240.2090.03824.57
7.0.230.1320.03824.56
7.0.220.1340.03824.52
7.0.210.1300.03724.48
7.0.200.1360.03924.46
7.0.190.1280.03824.52
7.0.180.1230.04324.47
7.0.170.1230.03824.50
7.0.160.1300.03924.46
7.0.150.1190.03824.46
7.0.140.1160.03824.44
7.0.130.1050.03824.50
7.0.120.1080.04024.48
7.0.110.1130.03924.52
7.0.100.1170.03924.41
7.0.90.1160.03624.45
7.0.80.1020.03724.46
7.0.70.1210.03524.42
7.0.60.1130.03824.46
7.0.50.1120.03724.41
7.0.40.1110.04024.48
7.0.30.1100.03824.51
7.0.20.1120.03824.46
7.0.10.1280.03724.49
7.0.00.1040.04024.46
5.6.400.0480.20647.34
5.6.390.0440.21347.36
5.6.380.0460.20147.11
5.6.370.0450.19847.17
5.6.360.0460.19447.25
5.6.350.0430.20147.23
5.6.340.0480.20547.20
5.6.330.0500.20647.20
5.6.320.0460.20447.21
5.6.310.0470.20347.25
5.6.300.0420.20247.21
5.6.290.0450.20247.27
5.6.280.0440.20847.29
5.6.270.0470.20447.26
5.6.260.0480.20247.28
5.6.250.0450.20347.29
5.6.240.0450.19947.31
5.6.230.0440.19947.35
5.6.220.0460.19947.36
5.6.210.0460.19847.32
5.6.200.0410.20847.34
5.6.190.0430.20547.34
5.6.180.0450.20847.37
5.6.170.0430.21247.38
5.6.160.0400.20747.34
5.6.150.0460.20647.32
5.6.140.0460.20247.30
5.6.130.0460.20347.34
5.6.120.0440.20547.33
5.6.110.0460.21247.30
5.6.100.0470.20747.27
5.6.90.0490.19447.26
5.6.80.0460.20147.18
5.6.70.0470.19647.22
5.6.60.0460.19947.28
5.6.50.0440.20547.23
5.6.40.0460.20347.28
5.6.30.0490.20247.25
5.6.20.0440.21347.24
5.6.10.0440.20247.23
5.6.00.0440.20047.20
5.5.380.0420.20846.61
5.5.370.0470.20246.65
5.5.360.0430.21846.55
5.5.350.0460.20246.57
5.5.340.0430.20946.58
5.5.330.0440.21046.55
5.5.320.0490.21446.53
5.5.310.0460.20946.56
5.5.300.0440.20446.55
5.5.290.0430.21346.60
5.5.280.0430.20546.58
5.5.270.0430.20746.53
5.5.260.0400.21246.52
5.5.250.0440.20546.56
5.5.240.0440.20146.59
5.5.230.0440.20546.53
5.5.220.0450.20046.53
5.5.210.0450.21546.59
5.5.200.0480.21746.50
5.5.190.0440.20746.49
5.5.180.0450.21646.51
5.5.170.0420.20246.63
5.5.160.0440.20546.48
5.5.150.0420.20746.51
5.5.140.0450.20946.46
5.5.130.0460.21446.44
5.5.120.0460.20246.47
5.5.110.0450.20746.39
5.5.100.0460.21846.59
5.5.90.0430.21146.53
5.5.80.0420.21246.54
5.5.70.0440.21646.50
5.5.60.0460.20846.54
5.5.50.0450.20646.48
5.5.40.0450.20646.53
5.5.30.0410.20646.48
5.5.20.0430.21146.53
5.5.10.0470.20446.47
5.5.00.0400.20546.46
5.4.450.0400.21044.01
5.4.440.0440.20244.02
5.4.430.0440.21843.98
5.4.420.0400.21244.02
5.4.410.0410.21244.03
5.4.400.0420.20443.97
5.4.390.0440.20443.97
5.4.380.0410.20743.96
5.4.370.0430.21943.94
5.4.360.0420.21043.95
5.4.350.0430.21243.94
5.4.340.0430.21143.93
5.4.330.0460.20243.86
5.4.320.0430.21243.95
5.4.310.0440.20644.00
5.4.300.0440.21143.98
5.4.290.0400.20343.97
5.4.280.0410.20843.95
5.4.270.0430.20843.99
5.4.260.0450.20643.97
5.4.250.0430.21243.93
5.4.240.0400.20943.94
5.4.230.0470.20543.87
5.4.220.0430.21543.84
5.4.210.0420.21743.83
5.4.200.0420.20643.83
5.4.190.0400.20543.87
5.4.180.0420.21343.82
5.4.170.0410.20743.85
5.4.160.0390.20843.84
5.4.150.0420.20743.84
5.4.140.0410.20143.87
5.4.130.0380.20543.88
5.4.120.0420.19743.88
5.4.110.0390.20343.92
5.4.100.0410.20843.92
5.4.90.0410.20243.93
5.4.80.0410.20243.94
5.4.70.0440.20843.98
5.4.60.0380.20843.95
5.4.50.0400.20243.90
5.4.40.0420.21443.91
5.4.30.0410.21643.95
5.4.20.0410.20843.94
5.4.10.0430.21543.94
5.4.00.0430.20943.81

preferences:
83.1 ms | 400 KiB | 5 Q