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)
7.4.10.0160.03224.29
7.4.00.0130.04624.32
7.3.130.0190.02924.29
7.3.120.0200.03724.00
7.3.110.0100.05023.83
7.3.100.0100.03424.08
7.3.90.0100.03823.94
7.3.80.0160.02523.99
7.3.70.0100.03824.17
7.3.60.0070.03423.88
7.3.50.0130.03623.96
7.3.40.0100.03023.90
7.3.30.0030.04024.09
7.3.20.0070.03324.80
7.3.10.0060.03124.72
7.3.00.0140.02724.47
7.2.260.0070.05324.40
7.2.250.0130.04024.23
7.2.240.0060.03624.39
7.2.230.0070.04724.05
7.2.220.0130.03224.31
7.2.210.0060.03524.25
7.2.200.0100.03524.53
7.2.190.0060.03924.43
7.2.180.0100.02824.05
7.2.170.0100.03624.19
7.2.160.0070.03524.14
7.2.150.0030.03724.87
7.2.140.0070.02924.70
7.2.130.0160.02624.76
7.2.120.0070.03524.79
7.2.110.0030.03624.88
7.2.100.0030.03624.77
7.2.90.0070.03024.95
7.2.80.0060.03524.85
7.2.70.0030.04924.92
7.2.60.0290.03724.63
7.2.50.0980.03724.46
7.2.40.0310.03724.55
7.2.30.0390.02924.65
7.2.20.0380.03124.51
7.2.10.0690.03824.35
7.2.00.0360.03424.48
7.1.330.0100.04123.74
7.1.320.0070.04423.80
7.1.310.0030.04923.77
7.1.300.0000.05623.73
7.1.290.0070.04223.82
7.1.280.0030.04323.64
7.1.270.0030.04723.77
7.1.260.0030.04923.85
7.1.250.0030.04723.65
7.1.240.0060.04524.03
7.1.230.0000.05523.88
7.1.220.0000.05123.51
7.1.210.0100.04223.71
7.1.200.0030.04423.91
7.1.190.0030.05323.68
7.1.180.0190.03623.91
7.1.170.0410.04423.44
7.1.160.0480.04123.16
7.1.150.0260.04523.46
7.1.140.0380.04023.53
7.1.130.0330.04023.54
7.1.120.0430.03323.49
7.1.110.0860.04023.49
7.1.100.0440.04623.63
7.1.90.0460.03323.55
7.1.80.0490.04723.50
7.1.70.0340.04423.58
7.1.60.0510.04232.54
7.1.50.0480.03932.52
7.1.40.0400.04432.66
7.1.30.0810.04432.48
7.1.20.0500.04932.36
7.1.10.0360.04223.54
7.1.00.0380.04023.32
7.0.330.0000.05723.51
7.0.320.0000.05623.53
7.0.310.0070.04723.53
7.0.300.0330.04423.30
7.0.290.0810.04823.41
7.0.280.0100.04923.55
7.0.270.0440.04323.46
7.0.260.0340.05223.46
7.0.250.0380.03923.42
7.0.240.0320.04423.33
7.0.230.0360.05123.41
7.0.220.0820.04723.32
7.0.210.0410.04623.31
7.0.200.0960.04423.36
7.0.190.0470.04123.38
7.0.180.0320.04623.50
7.0.170.0470.04223.39
7.0.160.0420.04023.39
7.0.150.0350.04623.45
7.0.140.0320.04823.33
7.0.130.0410.04123.44
7.0.120.0580.04923.43
7.0.110.0450.04523.42
7.0.100.0410.04823.31
7.0.90.0340.04523.50
7.0.80.0300.04923.14
7.0.70.0350.04223.25
7.0.60.0410.04423.33
7.0.50.0340.04323.13
7.0.40.0350.04718.48
7.0.30.0270.05518.52
7.0.20.0430.05118.43
7.0.10.0340.05018.64
7.0.00.0640.04818.55
5.6.400.0260.17846.07
5.6.390.0170.19146.12
5.6.380.0130.21546.46
5.6.370.0200.18646.33
5.6.360.0230.18446.15
5.6.350.0270.19346.09
5.6.340.0200.18846.20
5.6.330.0300.20446.12
5.6.320.0230.20045.99
5.6.310.0240.18646.00
5.6.300.0360.22545.82
5.6.290.0340.22246.17
5.6.280.0350.22446.02
5.6.270.0260.22446.25
5.6.260.0230.23646.02
5.6.250.0360.22746.40
5.6.240.0370.23946.21
5.6.230.0320.21345.94
5.6.220.0400.22145.86
5.6.210.0380.21046.17
5.6.200.0440.20746.12
5.6.190.0360.21146.18
5.6.180.0340.22946.05
5.6.170.0250.21546.09
5.6.160.0320.20046.09
5.6.150.0380.19145.98
5.6.140.0280.22546.15
5.6.130.0270.20946.00
5.6.120.0270.21146.04
5.6.110.0350.22946.08
5.6.100.0320.24046.05
5.6.90.0270.20446.17
5.6.80.0320.20946.14
5.6.70.0330.23745.97
5.6.60.0350.23045.99
5.6.50.0370.21045.93
5.6.40.0300.21545.86
5.6.30.0350.22146.21
5.6.20.0230.20645.96
5.6.10.0230.21246.05
5.6.00.0290.20245.97
5.5.380.0550.20542.82
5.5.370.0470.22942.94
5.5.360.0360.22742.55
5.5.350.0450.23643.06
5.5.340.0360.22543.18
5.5.330.0330.24242.82
5.5.320.0320.25742.74
5.5.310.0350.28443.16
5.5.300.0370.24442.88
5.5.290.0420.21142.80
5.5.280.0700.26743.05
5.5.270.0380.25342.81
5.5.260.0440.22243.17
5.5.250.0380.26842.92
5.5.240.0330.22342.88
5.5.230.0510.20742.96
5.5.220.0400.24242.63
5.5.210.0440.22943.07
5.5.200.0520.20743.04
5.5.190.0430.26642.91
5.5.180.0250.26742.55
5.5.160.0480.30942.66
5.5.150.0740.33442.60
5.5.140.0520.24942.67
5.5.130.0330.23442.59
5.5.120.0560.22942.64
5.5.110.0310.21442.80
5.5.100.0570.22143.04
5.5.90.0290.25842.54
5.5.80.0570.22942.61
5.5.70.0270.23742.78
5.5.60.0360.26442.39
5.5.50.0600.22642.40
5.5.40.0400.24942.66
5.5.30.0320.22442.13
5.5.20.0360.24842.57
5.5.10.0240.24242.14
5.5.00.0390.20642.20
5.4.450.0400.21442.79
5.4.440.0350.25342.98
5.4.430.0260.25642.89
5.4.420.0460.22542.78
5.4.410.0200.25842.70
5.4.400.0370.24942.83
5.4.390.0500.22342.73
5.4.380.0400.24842.39
5.4.370.0570.21442.86
5.4.360.0260.23442.78
5.4.350.0360.23142.53
5.4.340.0400.26442.71
5.4.320.0490.21742.82
5.4.310.0360.28242.85
5.4.300.0600.23142.72
5.4.290.0250.26642.91
5.4.280.0460.34242.59
5.4.270.0330.25042.51
5.4.260.0450.23042.64
5.4.250.0310.22942.72
5.4.240.0300.24542.62
5.4.230.0320.25242.90
5.4.220.0550.22542.70
5.4.210.0460.23442.52
5.4.200.0300.22842.64
5.4.190.0260.26642.46
5.4.180.0270.25142.66
5.4.170.0490.21842.77
5.4.160.0400.23642.54
5.4.150.0360.29542.81
5.4.140.0520.21942.83
5.4.130.0380.28842.85
5.4.120.0330.23542.91
5.4.110.0370.24542.75
5.4.100.0440.23242.60
5.4.90.0400.22843.02
5.4.80.0420.24042.98
5.4.70.0260.23442.92
5.4.60.0430.28642.82
5.4.50.0310.26442.72
5.4.40.0600.21742.72
5.4.30.0440.30242.59
5.4.20.0400.21042.79
5.4.10.0410.26642.76
5.4.00.0320.30142.86
5.3.290.0490.33344.65
5.3.280.0390.30644.50
5.3.270.0330.27144.46
5.3.260.0420.24044.45
5.3.250.0490.23344.71
5.3.240.0620.28844.54
5.3.230.0470.28344.60
5.3.220.0350.30644.50
5.3.210.0560.30144.53
5.3.200.0300.25044.25
5.3.190.0480.36144.62
5.3.180.0430.26044.66
5.3.170.0190.27544.72
5.3.160.0480.24444.71
5.3.150.0360.24944.61
5.3.140.0560.23344.67
5.3.130.0560.26144.57
5.3.120.0540.26844.44
5.3.110.0480.36344.45
5.3.100.0330.27444.46
5.3.90.0390.25144.62
5.3.80.0400.25844.27
5.3.70.0730.20844.18
5.3.60.0330.24844.53
5.3.50.0480.27044.58
5.3.40.0400.23744.53
5.3.30.0290.26144.63
5.3.20.0390.29444.38
5.3.10.0200.26344.27
5.3.00.0130.26044.32
5.2.170.0330.26242.20
5.2.160.0270.28541.90
5.2.150.0320.26942.21
5.2.140.0560.34742.01
5.2.130.0390.28842.08
5.2.120.0430.28941.92
5.2.110.0200.27242.18
5.2.100.0420.31042.02
5.2.90.0500.28941.91
5.2.80.0390.27241.95
5.2.70.0390.25241.70
5.2.60.0310.29841.96
5.2.50.0330.31142.39
5.2.40.0480.32342.61
5.2.30.0380.36542.45
5.2.20.0450.27342.52
5.2.10.0370.29847.21
5.2.00.0100.0009.32
5.1.60.0100.0008.51
5.1.50.0070.0028.51
5.1.40.0040.0068.71
5.1.30.0000.0098.70
5.1.20.0090.0008.71
5.1.10.0030.0068.69
5.1.00.0070.0028.48
5.0.50.0100.0007.64
5.0.40.0080.0007.64
5.0.30.0040.0047.64
5.0.20.0050.0037.64
5.0.10.0070.0007.64
5.0.00.0030.0037.64
4.4.90.0050.0027.64
4.4.80.0050.0057.64
4.4.70.0070.0007.64
4.4.60.0070.0007.64
4.4.50.0030.0037.64
4.4.40.0070.0007.64
4.4.30.0060.0037.64
4.4.20.0000.0077.64
4.4.10.0040.0027.64
4.4.00.0000.0097.64
4.3.110.0060.0007.64
4.3.100.0030.0037.64
4.3.90.0060.0007.64
4.3.80.0060.0007.64
4.3.70.0000.0067.64
4.3.60.0040.0027.64
4.3.50.0070.0007.64
4.3.40.0060.0007.64
4.3.30.0000.0057.64
4.3.20.0000.0067.64
4.3.10.0060.0007.64
4.3.00.0050.0037.64

preferences:
45.67 ms | 401 KiB | 5 Q