3v4l.org

run code in 300+ PHP versions simultaneously
<?php // 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\n"; // Time serialization $start = microtime( true ); serialize( $testArray ); $serializeTime = microtime( true ) - $start; echo "PHP serialized in $serializeTime seconds\n"; // 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)
7.2.00.0130.01927.23
7.1.70.0000.02824.84
7.1.60.0070.05225.06
7.1.50.0030.05424.83
7.1.00.0070.10030.38
7.0.200.0000.02924.58
7.0.140.0070.10330.16
7.0.90.0100.12029.56
7.0.80.1370.10029.58
7.0.70.1330.10329.52
7.0.60.2500.09029.70
7.0.50.2630.10329.83
7.0.40.0170.09720.42
7.0.30.0000.06320.38
7.0.20.0070.10720.32
7.0.10.0030.06320.36
7.0.00.0030.07020.37
5.6.280.0030.24752.68
5.6.240.0300.18751.95
5.6.230.0170.19752.30
5.6.220.0270.14752.20
5.6.210.0100.18752.21
5.6.200.0200.22052.78
5.6.190.0200.20052.83
5.6.180.0170.20752.70
5.6.170.0030.18352.63
5.6.160.0070.20052.66
5.6.150.0300.14052.74
5.6.140.0200.21352.70
5.6.130.0230.20352.63
5.6.120.0230.20352.71
5.6.110.0130.20352.70
5.6.100.0230.15352.81
5.6.90.0130.18052.67
5.6.80.0070.18352.13
5.6.70.0200.22752.14
5.6.60.0230.23751.98
5.6.50.0100.16752.06
5.6.40.0170.15052.02
5.6.30.0300.13752.12
5.6.20.0100.16752.01
5.6.10.0130.19352.19
5.6.00.0200.14352.02
5.5.380.0170.22352.08
5.5.370.0130.25052.09
5.5.360.0230.19352.19
5.5.350.0100.13752.02
5.5.340.0130.16352.46
5.5.330.0130.21352.54
5.5.320.0170.22351.97
5.5.310.0200.23352.43
5.5.300.0270.21052.28
5.5.290.0200.17052.48
5.5.280.0300.22052.30
5.5.270.0200.21752.41
5.5.260.0170.21352.43
5.5.250.0170.17052.20
5.5.240.0130.21051.37
5.5.230.0230.20351.89
5.5.220.0370.20051.96
5.5.210.0130.18351.91
5.5.200.0170.16051.84
5.5.190.0030.17051.87
5.5.180.0270.19751.65
5.5.160.0170.15751.81
5.5.150.0130.19351.93
5.5.140.0100.16351.77
5.5.130.0100.20051.83
5.5.120.0130.22751.94
5.5.110.0100.16051.80
5.5.100.0130.21051.68
5.5.90.0070.22751.71
5.5.80.0030.20751.67
5.5.70.0170.20351.80
5.5.60.0200.17351.77
5.5.50.0130.21051.79
5.5.40.0300.19751.82
5.5.30.0100.21351.71
5.5.20.0200.21351.71
5.5.10.0200.20751.67
5.5.00.0200.23051.71
5.4.450.0200.23051.02
5.4.440.0170.22350.99
5.4.430.0170.16350.99
5.4.420.0300.22051.00
5.4.410.0230.22750.64
5.4.400.0170.23350.63
5.4.390.0200.20350.68
5.4.380.0170.21350.49
5.4.370.0200.22050.54
5.4.360.0100.16050.80
5.4.350.0130.19050.48
5.4.340.0030.19350.58
5.4.320.0070.16750.83
5.4.310.0330.12750.64
5.4.300.0270.16050.59
5.4.290.0300.14350.54
5.4.280.0170.15050.48
5.4.270.0170.16050.53
5.4.260.0100.19050.48
5.4.250.0130.18350.43
5.4.240.0330.19350.70
5.4.230.0170.23750.63
5.4.220.0300.19350.76
5.4.210.0070.17050.69
5.4.200.0230.23050.46
5.4.190.0100.16350.43
5.4.180.0200.17050.48
5.4.170.0230.21050.57
5.4.160.0130.18050.42
5.4.150.0100.19350.20
5.4.140.0200.19347.94
5.4.130.0170.17047.85
5.4.120.0470.24047.96
5.4.110.0230.20748.11
5.4.100.0170.16047.95
5.4.90.0100.17047.91
5.4.80.0330.21048.01
5.4.70.0070.21347.93
5.4.60.0170.19748.11
5.4.50.0130.22048.07
5.4.40.0200.21347.91
5.4.30.0170.22347.89
5.4.20.0200.21747.83
5.4.10.0270.19047.88
5.4.00.0130.15747.41
5.3.290.0200.24748.77
5.3.280.0170.24048.61
5.3.270.0170.23048.63
5.3.260.0230.25348.60
5.3.250.0170.24748.63
5.3.240.0170.22748.60
5.3.230.0270.22048.63
5.3.220.0100.22348.66
5.3.210.0300.24748.70
5.3.200.0200.20748.56
5.3.190.0200.23048.52
5.3.180.0130.24748.52
5.3.170.0130.25348.62
5.3.160.0130.22348.66
5.3.150.0370.24748.61
5.3.140.0230.24048.61
5.3.130.0100.24348.54
5.3.120.0170.26348.63
5.3.110.0330.16748.64
5.3.100.0070.19349.08
5.3.90.0230.20748.13
5.3.80.0130.20748.05
5.3.70.0070.21747.96
5.3.60.0100.18748.00
5.3.50.0230.23747.86
5.3.40.0270.18347.97
5.3.30.0230.18747.84
5.3.20.0230.16047.61
5.3.10.0100.19347.60
5.3.00.0300.22747.55
5.2.170.0230.22343.90
5.2.160.0130.22743.95
5.2.150.0230.18343.78
5.2.140.0130.22043.88
5.2.130.0130.16743.95
5.2.120.0200.23043.97
5.2.110.0130.17043.89
5.2.100.0100.24344.00
5.2.90.0070.19343.85
5.2.80.0270.20744.49
5.2.70.0100.21343.71
5.2.60.0200.23743.80
5.2.50.0100.21044.38
5.2.40.0130.20744.27
5.2.30.0000.21744.38
5.2.20.0230.22344.43
5.2.10.0130.27748.77
5.2.00.0100.05710.95
5.1.60.0000.04010.32
5.1.50.0100.05310.32
5.1.40.0070.05010.32
5.1.30.0030.05310.32
5.1.20.0000.05310.51
5.1.10.0030.05710.32
5.1.00.0000.05010.32
5.0.50.0000.04310.32
5.0.40.0000.05010.32
5.0.30.0000.05710.32
5.0.20.0070.03010.32
5.0.10.0030.04010.32
5.0.00.0000.03310.32
4.4.90.0030.02310.32
4.4.80.0100.02710.32
4.4.70.0030.03710.32
4.4.60.0000.03010.32
4.4.50.0000.03310.32
4.4.40.0130.04310.32
4.4.30.0000.03010.32
4.4.20.0030.03310.32
4.4.10.0070.01710.32
4.4.00.0030.04710.32
4.3.110.0030.03010.32
4.3.100.0000.03710.32
4.3.90.0030.01710.32
4.3.80.0130.03710.32
4.3.70.0000.03310.32
4.3.60.0070.03010.32
4.3.50.0000.03710.32
4.3.40.0000.05710.32
4.3.30.0000.03310.32
4.3.20.0030.03710.32
4.3.10.0000.03710.32
4.3.00.0030.03310.32

preferences:
35.66 ms | 401 KiB | 5 Q