3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Point { } class Dimension { } class Rectangle { } $items = array(true, false, null, 23, 0, -26, 4.21, 0.0, -3.76, 'hello', '', array(1, 2, 3), array('', '', ''), array(), new stdClass(), new Point(), new Dimension(), new Rectangle()); echo '<table cellpadding="4" border="1"> <tr> <th>syntax</th> <th>value</th> <th>type</th> <th>empty</th> <th>boolean</th> </tr>' . "\n"; foreach($items AS $item) { $booleanValue = (boolean)$item; $empty = (empty($item) ? 'EMPTY' : '&nbsp;'); $type = gettype($item); $syntax = 'if((boolean)'; $val; if($type == boolean) { $val = ($booleanValue ? 'true' : 'false'); $syntax .= ($val . ')'); } else if($type == 'NULL') { $val = 'null'; $syntax .= 'null)'; } else if($type == double && !$booleanValue) { $val = '0.0'; $syntax .= '0.0)'; } else if($type == string) { $val = '\'' . $item . '\''; $syntax .= ($val . ')'); } else if($type == 'array') { $val = $item; $syntax .= '$array)'; } else if($type == 'object') { $val = get_class($item); $syntax .= ('$' . strtolower($val) . ')'); } else { $val = $item; $syntax .= ($val . ')'); } echo ' <tr style="color: ' . ($booleanValue ? '#006600' : '#880000') . ';"> <td><code>' . $syntax . '</code></td> <td>' . $val . '</td> <td>' . $type . '</td> <td>' . $empty . '</td> <td>' . ($booleanValue ? 'TRUE' : 'FALSE') . '</td> </tr>' . "\n"; } echo '</table>' . "\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.3.60.0100.01018.43
8.3.50.0160.00521.09
8.3.40.0110.00718.81
8.3.30.0070.00720.18
8.3.20.0040.00420.51
8.3.10.0000.00821.08
8.3.00.0040.00422.39
8.2.180.0070.01125.92
8.2.170.0100.01022.96
8.2.160.0100.00320.39
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0080.00020.73
8.2.110.0000.00921.03
8.2.100.0110.00017.84
8.2.90.0000.00719.17
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0040.00418.03
8.2.50.0030.00518.07
8.2.40.0040.00418.21
8.2.30.0050.00219.48
8.2.20.0030.00517.89
8.2.10.0030.00517.78
8.2.00.0040.00417.91
8.1.280.0060.00825.92
8.1.270.0110.00723.99
8.1.260.0110.00326.35
8.1.250.0070.00028.09
8.1.240.0090.00019.28
8.1.230.0070.00420.92
8.1.220.0000.00818.77
8.1.210.0080.00018.88
8.1.200.0060.00317.48
8.1.190.0000.00917.66
8.1.180.0040.00918.10
8.1.170.0030.00518.77
8.1.160.0000.00718.98
8.1.150.0050.00318.59
8.1.140.0080.00017.41
8.1.130.0030.00317.91
8.1.120.0040.00417.53
8.1.110.0040.00417.49
8.1.100.0040.00417.48
8.1.90.0040.00417.37
8.1.80.0040.00417.50
8.1.70.0030.00317.55
8.1.60.0060.00317.58
8.1.50.0030.00517.59
8.1.40.0000.00717.46
8.1.30.0040.00417.74
8.1.20.0000.00817.71
8.1.10.0000.00817.60
8.1.00.0030.00717.58
8.0.300.0070.00019.98
8.0.290.0000.00817.25
8.0.280.0080.00018.43
8.0.270.0040.00417.23
8.0.260.0060.00316.85
8.0.250.0030.00317.11
8.0.240.0060.00317.12
8.0.230.0040.00417.00
8.0.220.0000.00816.98
8.0.210.0030.00317.00
8.0.200.0060.00017.09
8.0.190.0000.00816.96
8.0.180.0050.00217.00
8.0.170.0040.00417.02
8.0.160.0000.00717.03
8.0.150.0030.00317.06
8.0.140.0070.00016.89
8.0.130.0030.00313.48
8.0.120.0000.00816.97
8.0.110.0050.00317.05
8.0.100.0080.00016.93
8.0.90.0020.00517.05
8.0.80.0090.00917.00
8.0.70.0040.00417.04
8.0.60.0030.00516.89
8.0.50.0000.00716.79
8.0.30.0110.00717.04
8.0.20.0110.00817.40
8.0.10.0040.00417.02
8.0.00.0100.00816.84
7.4.330.0000.00516.78
7.4.320.0060.00016.57
7.4.300.0030.00316.52
7.4.290.0000.00716.65
7.4.280.0030.00316.57
7.4.270.0000.00716.69
7.4.260.0050.00013.36
7.4.250.0040.00416.48
7.4.240.0000.00716.48
7.4.230.0040.00416.66
7.4.220.0130.00616.60
7.4.210.0070.00916.61
7.4.200.0050.00216.36
7.4.190.0040.00416.80
7.4.160.0150.00316.62
7.4.150.0140.00717.40
7.4.140.0120.00717.86
7.4.130.0090.01316.74
7.4.120.0090.00916.57
7.4.110.0110.00716.67
7.4.100.0070.01716.52
7.4.90.0060.01216.49
7.4.80.0090.01219.39
7.4.70.0100.00716.59
7.4.60.0120.00616.53
7.4.50.0040.00416.50
7.4.40.0070.00322.77
7.4.30.0070.01116.60
7.4.00.0060.00615.23
7.3.330.0060.00013.50
7.3.320.0000.00513.40
7.3.310.0000.00816.31
7.3.300.0000.00716.32
7.3.290.0100.00716.39
7.3.280.0090.00816.42
7.3.270.0090.00917.40
7.3.260.0110.01118.24
7.3.250.0100.00816.52
7.3.240.0150.00316.64
7.3.230.0080.01116.66
7.3.210.0150.00416.57
7.3.200.0130.00919.39
7.3.190.0070.01316.65
7.3.180.0040.01416.39
7.3.170.0090.00916.38
7.3.160.0000.01716.45
7.3.120.0100.00614.80
7.3.10.0160.00615.98
7.3.00.0320.00016.21
7.2.330.0070.01116.80
7.2.320.0100.01416.95
7.2.310.0120.01216.93
7.2.300.0090.00916.52
7.2.290.0160.00316.58
7.2.130.0110.01116.39
7.2.120.0100.00716.07
7.2.110.0120.00916.50
7.2.100.0070.01316.37
7.2.90.0110.01116.86
7.2.80.0160.01016.41
7.2.70.0130.01016.28
7.2.60.0150.00716.68
7.2.50.0170.00716.04
7.2.40.0070.01416.08
7.2.30.0130.01016.69
7.2.20.0160.00316.30
7.2.10.0090.00616.38
7.2.00.0120.00318.19
7.1.250.0080.00815.32
7.1.200.0100.00315.77
7.1.100.0100.00718.08
7.1.70.0090.00616.91
7.1.60.0070.01119.17
7.1.50.0030.02016.95
7.1.00.0070.03022.45
7.0.200.0110.00016.61
7.0.140.0070.07322.01
7.0.70.4870.04020.15
7.0.60.0030.08319.95
7.0.50.0030.08718.00
7.0.40.0030.05320.08
7.0.30.0330.07320.09
7.0.20.0270.08020.07
7.0.10.0330.08320.23
7.0.00.0070.05720.08
5.6.280.0100.06720.80
5.6.210.0100.04320.72
5.6.200.0100.05018.16
5.6.190.0030.05320.64
5.6.180.0030.05720.44
5.6.170.0370.07720.54
5.6.160.0000.04720.43
5.6.150.0070.08718.19
5.6.140.0000.06718.17
5.6.130.0170.07718.17
5.6.120.0030.04021.01
5.6.110.0100.06721.02
5.6.100.0070.06321.02
5.6.90.0000.04320.89
5.6.80.0170.06320.53
5.6.70.0230.07320.39
5.5.350.0070.08020.43
5.5.340.0070.05717.96
5.5.330.0170.07320.34
5.5.320.0130.06020.36
5.5.310.0330.07720.29
5.5.300.0030.08017.95
5.5.290.0030.07717.93
5.5.280.0030.04320.82
5.5.270.0100.03320.88
5.5.260.0070.08020.88
5.5.250.0170.07020.60
5.5.240.0070.05720.28
5.4.450.0330.06319.41
5.4.440.0300.06719.19
5.4.430.0200.06319.52
5.4.420.0200.07719.55
5.4.410.0200.06319.18
5.4.400.0230.07718.95
5.4.390.0330.06319.24
5.4.380.0130.05019.15
5.4.370.0170.07719.16
5.4.360.0270.06319.15
5.4.350.0270.06019.03
5.4.340.0070.05319.09
5.4.320.0270.06019.15
5.4.310.0170.06319.31
5.4.300.0200.04719.09
5.4.290.0300.05318.94
5.4.280.0230.04319.13
5.4.270.0270.05319.07
5.4.260.0270.06719.08
5.4.250.0370.06318.86
5.4.240.0200.08019.30
5.4.230.0200.05019.15
5.4.220.0270.07019.14
5.4.210.0300.05319.13
5.4.200.0230.06718.93
5.4.190.0170.06019.06
5.4.180.0370.06719.05
5.4.170.0270.05719.23
5.4.160.0300.06719.06
5.4.150.0270.06719.14
5.4.140.0230.03016.34
5.4.130.0330.06316.40
5.4.120.0230.07316.56
5.4.110.0230.06316.44
5.4.100.0230.07716.63
5.4.90.0170.04316.46
5.4.80.0230.07016.48
5.4.70.0100.04316.57
5.4.60.0200.03316.26
5.4.50.0200.04016.51
5.4.40.0230.05316.26
5.4.30.0230.07016.43
5.4.20.0170.05716.34
5.4.10.0230.03316.50
5.4.00.0230.03315.84
5.3.290.0170.04014.66
5.3.280.0270.07014.51
5.3.270.0230.07314.62
5.3.260.0200.04314.63
5.3.250.0230.04714.60
5.3.240.0200.03714.63
5.3.230.0170.05714.59
5.3.220.0170.06014.60
5.3.210.0300.06714.61
5.3.200.0170.07014.59
5.3.190.0270.04714.50
5.3.180.0200.07314.49
5.3.170.0270.07014.55
5.3.160.0300.06014.55
5.3.150.0200.07314.66
5.3.140.0270.07314.55
5.3.130.0400.06014.54
5.3.120.0130.05314.55
5.3.110.0230.05714.59
5.3.100.0200.05014.14
5.3.90.0200.03714.05
5.3.80.0200.07013.97
5.3.70.0170.04714.13
5.3.60.0270.06014.03
5.3.50.0200.07013.88
5.3.40.0200.07713.99
5.3.30.0300.06714.15
5.3.20.0270.04313.79
5.3.10.0230.04313.65
5.3.00.0170.03713.77
5.2.170.0170.05013.04
5.2.160.0200.02713.04
5.2.150.0200.04313.04
5.2.140.0230.05013.04
5.2.130.0070.03713.04
5.2.120.0170.03013.04
5.2.110.0200.06013.04
5.2.100.0230.04013.04
5.2.90.0170.06013.04
5.2.80.0230.05713.04
5.2.70.0130.06713.04
5.2.60.0230.06013.04
5.2.50.0200.05013.04
5.2.40.0130.04313.04
5.2.30.0170.03713.04
5.2.20.0170.04013.04
5.2.10.0170.03713.04
5.2.00.0230.05013.04
5.1.60.0200.03013.04
5.1.50.0270.03313.04
5.1.40.0270.04013.04
5.1.30.0170.05313.04
5.1.20.0230.04713.04
5.1.10.0130.05313.04
5.1.00.0200.05013.04
5.0.50.0070.04313.04
5.0.40.0100.04313.04
5.0.30.0100.04313.04
5.0.20.0130.04013.04
5.0.10.0070.03013.04
5.0.00.0100.03713.04
4.4.90.0070.04013.04
4.4.80.0030.03313.04
4.4.70.0170.02713.04
4.4.60.0100.03713.04
4.4.50.0030.02713.04
4.4.40.0030.04313.04
4.4.30.0070.04013.04
4.4.20.0170.02713.04
4.4.10.0230.00713.04
4.4.00.0070.05313.04
4.3.110.0130.02313.04
4.3.100.0070.03713.04
4.3.90.0070.02313.04
4.3.80.0000.05313.04
4.3.70.0070.03313.04
4.3.60.0100.03013.04
4.3.50.0130.02713.04
4.3.40.0100.05013.04
4.3.30.0000.02713.04
4.3.20.0100.02713.04
4.3.10.0030.03713.04
4.3.00.0030.03313.04

preferences:
45.9 ms | 401 KiB | 5 Q