3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); ?><!doctype html> <html> <head> <meta charset="utf-8"> <title>PHP comparisions</title> <style> table { border-collapse: collapse; } th, td { margin: 0; padding: 7px; border: 1px solid #ddd; } th { font-weight: normal; } tbody th { text-align: left; } td { text-align: center; } span.true { color: green; } span.false { color: red; } </style> </head> <body> <?php $values = array( '0', '""', '"0"', 'null', 'false', 'array()', 'array(null)', 'array(false)', 'array(0)', 'array("0")' ); ?><table> <thead><tr> <th></th> <th>if(...)</th> <th>empty</th> <th>is_null</th> <th>is_numeric</th> <?php for($i = 0; $i < count($values); $i++) { $Vi = getValue($values, $i); ?><th>== <?php echo formatValue($Vi); ?></th><?php ?><th>=== <?php echo formatValue($Vi); ?></th><?php } ?> </tr></thead> <tbody><?php for($i = 0; $i < count($values); $i++) { $Vi = getValue($values, $i); ?><tr> <th><?php echo formatValue($Vi); ?></th> <td><?php echo formatCompare($Vi); ?></td> <td><?php echo formatCompare(empty($Vi)); ?></td> <td><?php echo formatCompare(is_null($Vi)); ?></td> <td><?php echo formatCompare(is_numeric($Vi)); ?></td> <?php for($j = 0; $j < count($values); $j++) { $Vj = getValue($values, $j); ?> <td><?php echo formatCompare($Vi == $Vj); ?></td> <td><?php echo formatCompare($Vi === $Vj); ?></td> <?php } ?> </tr><?php } ?></tbody> </table> </body> </html><?php function getValue($values, $index) { eval('$v = ' . $values[$index] . ';'); return $v; } function formatValue($o) { switch(gettype($o)) { case 'integer': $result = $o; break; case 'string': $result = '"' . addslashes($o) . '"'; break; case 'NULL': $result = 'null'; break; case 'boolean': $result = $o ? 'true' : 'false'; break; case 'array': $values = array(); foreach($o as $v) { $values[] = formatValue($v); } $result = 'array(' . implode(', ', $values) . ')'; break; default: die(gettype($o)); } return $result; } function formatCompare($criteria) { if($criteria) { return '<span class="true">&#x2713;</span>'; } else { return '<span class="false">&#x2717;</span>'; } }

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.70.0140.00716.75
8.3.60.0090.00618.43
8.3.50.0090.00722.05
8.3.40.0130.00318.82
8.3.30.0030.01419.09
8.3.20.0050.00520.18
8.3.10.0060.00322.28
8.3.00.0090.00022.43
8.2.180.0090.00916.50
8.2.170.0190.00422.96
8.2.160.0170.00518.84
8.2.150.0030.00624.18
8.2.140.0100.00024.66
8.2.130.0050.00326.16
8.2.120.0070.00417.50
8.2.110.0070.00422.06
8.2.100.0060.00619.64
8.2.90.0080.00019.17
8.2.80.0030.00717.97
8.2.70.0080.00017.50
8.2.60.0040.00418.16
8.2.50.0070.00318.07
8.2.40.0000.00818.34
8.2.30.0090.00018.21
8.2.20.0040.00417.80
8.2.10.0030.00619.59
8.2.00.0090.00017.77
8.1.280.0070.01025.92
8.1.270.0180.00622.13
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0100.00023.79
8.1.230.0080.00419.14
8.1.220.0030.00517.76
8.1.210.0030.00518.77
8.1.200.0030.00717.35
8.1.190.0040.00417.64
8.1.180.0040.00418.10
8.1.170.0060.00318.56
8.1.160.0080.00021.96
8.1.150.0090.00018.66
8.1.140.0060.00317.61
8.1.130.0040.00417.85
8.1.120.0080.00017.40
8.1.110.0050.00317.47
8.1.100.0080.00017.44
8.1.90.0000.00817.47
8.1.80.0040.00417.49
8.1.70.0000.00717.39
8.1.60.0000.00917.51
8.1.50.0040.00417.46
8.1.40.0000.00817.51
8.1.30.0000.00917.72
8.1.20.0060.00317.63
8.1.10.0030.00617.68
8.1.00.0040.00417.54
8.0.300.0040.00418.77
8.0.290.0000.00817.18
8.0.280.0040.00418.46
8.0.270.0040.00417.29
8.0.260.0030.00316.91
8.0.250.0000.00817.04
8.0.240.0000.00717.05
8.0.230.0080.00016.92
8.0.220.0050.00316.80
8.0.210.0080.00016.95
8.0.200.0000.00717.04
8.0.190.0080.00016.95
8.0.180.0040.00416.93
8.0.170.0090.00017.00
8.0.160.0090.00016.93
8.0.150.0040.00416.89
8.0.140.0060.00316.90
8.0.130.0030.00313.34
8.0.120.0060.00316.91
8.0.110.0030.00516.88
8.0.100.0080.00016.95
8.0.90.0000.00816.89
8.0.80.0070.01416.91
8.0.70.0030.00616.89
8.0.60.0040.00416.86
8.0.50.0040.00416.90
8.0.30.0160.01417.20
8.0.20.0160.00717.40
8.0.10.0040.00416.94
8.0.00.0140.01116.86
7.4.330.0000.00915.00
7.4.320.0040.00416.52
7.4.300.0040.00416.56
7.4.290.0040.00416.51
7.4.280.0040.00416.53
7.4.270.0000.00716.48
7.4.260.0030.00716.63
7.4.250.0030.00616.61
7.4.240.0050.00316.50
7.4.230.0040.00416.64
7.4.220.0030.01516.60
7.4.210.0050.01116.60
7.4.200.0000.00716.47
7.4.190.0040.00416.60
7.4.160.0180.00416.53
7.4.150.0080.01317.40
7.4.140.0130.01017.86
7.4.130.0130.01116.46
7.4.120.0140.00716.52
7.4.110.0140.01416.34
7.4.100.0180.00516.56
7.4.90.0130.00916.59
7.4.80.0190.00319.39
7.4.70.0120.01416.63
7.4.60.0120.00616.38
7.4.50.0060.00316.68
7.4.40.0060.01222.77
7.4.30.0070.01116.47
7.4.00.0000.01614.84
7.3.330.0030.00313.27
7.3.320.0060.00013.49
7.3.310.0000.00816.34
7.3.300.0000.00716.39
7.3.290.0060.01216.36
7.3.280.0120.00616.41
7.3.270.0160.00817.40
7.3.260.0180.00616.56
7.3.250.0140.00716.46
7.3.240.0060.01516.68
7.3.230.0140.01116.50
7.3.210.0190.00316.60
7.3.200.0070.01319.39
7.3.190.0130.01016.32
7.3.180.0130.00416.59
7.3.170.0150.00916.49
7.3.160.0130.00516.47
7.3.120.0040.01414.91
7.2.330.0110.01116.66
7.2.320.0130.01316.70
7.2.310.0110.00916.63
7.2.300.0090.01216.91
7.2.290.0130.01316.58
7.2.60.0150.00016.89
7.2.00.0110.00319.42
7.1.200.0030.01215.94
7.1.100.0030.01317.91
7.1.70.0070.00316.92
7.1.60.0040.00717.23
7.1.50.0040.00716.74
7.1.00.0000.08322.34
7.0.200.0030.00916.70
7.0.140.0070.07322.04
7.0.60.0100.06720.00
7.0.50.0030.04717.77
7.0.40.0070.04019.96
7.0.30.0270.08720.25
7.0.20.0200.04720.19
7.0.10.0130.05720.06
7.0.00.0070.08720.34
5.6.280.0130.06721.16
5.6.210.0100.07720.79
5.6.200.0100.08018.17
5.6.190.0030.04720.58
5.6.180.0430.07720.36
5.6.170.0300.08020.50
5.6.160.0100.04020.44
5.6.150.0000.04318.15
5.6.140.0070.05718.17
5.6.130.0000.04318.29
5.6.120.0000.05020.81
5.6.110.0100.07021.15
5.6.100.0000.04321.15
5.6.90.0070.06720.99
5.6.80.0030.08720.43
5.5.350.0170.08320.44
5.5.340.0130.08018.07
5.5.330.0130.06720.15
5.5.320.0030.05020.36
5.5.310.0270.04020.19
5.5.300.0030.08717.96
5.5.290.0100.08317.92
5.5.280.0000.04720.77
5.5.270.0130.07020.90
5.5.260.0100.03720.79
5.5.250.0100.03320.50
5.5.240.0130.03020.39
5.4.450.0970.03019.56
5.4.440.0230.05319.41
5.4.430.0970.03719.48
5.4.420.0930.03719.45
5.4.410.0730.04019.38
5.4.400.0900.04719.07
5.4.390.0670.04319.11
5.4.380.0600.07018.65
5.4.370.0300.06018.72
5.4.360.0470.05718.71
5.4.350.0200.07318.83
5.4.340.0270.06018.80
5.4.320.0080.04512.56
5.4.310.0140.03812.55
5.4.300.0060.04012.57
5.4.290.0100.04612.56
5.4.280.0130.03912.46
5.4.270.0200.07019.00
5.4.260.0030.06719.00
5.4.250.0200.07018.99
5.4.240.0200.07718.91
5.4.230.0100.08319.02
5.4.220.0030.07718.83
5.4.210.0270.05318.86
5.4.200.0270.05319.01
5.4.190.0130.06718.85
5.4.180.0300.05018.85
5.4.170.0230.06319.11
5.4.160.0170.06018.92
5.4.150.0130.08319.18
5.4.140.0130.06016.49
5.4.130.0030.05716.67
5.4.120.0070.06016.45
5.4.110.0230.05016.45
5.4.100.0100.05316.72
5.4.90.0030.05716.72
5.4.80.0130.04716.45
5.4.70.0100.05016.69
5.4.60.0170.05316.71
5.4.50.0170.05716.68
5.4.40.0200.06316.70
5.4.30.0070.06016.66
5.4.20.0100.05716.56
5.4.10.0170.05316.66
5.4.00.0170.04716.01
5.3.290.0090.04912.82
5.3.280.0070.06014.93
5.3.270.0230.04714.73
5.3.260.0100.06714.72
5.3.250.0130.06014.67
5.3.240.0200.05314.97
5.3.230.0200.05314.93
5.3.220.0100.05314.63
5.3.210.0100.05714.92
5.3.200.0100.05314.94
5.3.190.0070.06314.69
5.3.180.0030.05714.85
5.3.170.0070.06014.51
5.3.160.0100.07314.68
5.3.150.0200.05014.63
5.3.140.0130.07014.69
5.3.130.0100.07314.92
5.3.120.0230.04714.88
5.3.110.0200.06714.84
5.3.100.0100.05014.28
5.3.90.0030.06714.37
5.3.80.0130.05014.15
5.3.70.0170.04714.39
5.3.60.0200.05714.06
5.3.50.0070.07714.29
5.3.40.0100.05714.09
5.3.30.0130.07014.18
5.3.20.0070.06014.03
5.3.10.0200.05713.78
5.3.00.0200.04713.77
5.2.170.0130.05311.46
5.2.160.0000.07011.42
5.2.150.0170.03711.23
5.2.140.0070.07711.43
5.2.130.0070.05711.40
5.2.120.0200.03711.37
5.2.110.0030.04711.19
5.2.100.0070.04311.39
5.2.90.0000.04711.18
5.2.80.0030.04311.17
5.2.70.0070.04711.48
5.2.60.0130.03711.41
5.2.50.0070.04711.30
5.2.40.0070.04311.14
5.2.30.0000.05011.25
5.2.20.0100.04011.10
5.2.10.0170.04311.09
5.2.00.0100.03710.95
5.1.60.0070.03710.34
5.1.50.0070.04010.25
5.1.40.0100.04710.00
5.1.30.0070.03710.36
5.1.20.0130.03010.66
5.1.10.0100.04010.26
5.1.00.0130.04010.09
5.0.50.0030.0308.90
5.0.40.0070.0338.77
5.0.30.0070.0478.16
5.0.20.0000.0408.50
5.0.10.0070.0338.21
5.0.00.0130.0508.42
4.4.90.0030.0237.74
4.4.80.0030.0237.74
4.4.70.0030.0237.74
4.4.60.0000.0307.74
4.4.50.0030.0277.74
4.4.40.0070.0337.74
4.4.30.0070.0277.74
4.4.20.0030.0307.74
4.4.10.0100.0177.74
4.4.00.0070.0337.74
4.3.110.0030.0237.74
4.3.100.0000.0277.74
4.3.90.0070.0237.74
4.3.80.0070.0437.74
4.3.70.0070.0207.74
4.3.60.0100.0207.45
4.3.50.0070.0337.42
4.3.40.0000.0437.42
4.3.30.0030.0277.42
4.3.20.0070.0277.42
4.3.10.0070.0207.42
4.3.00.0170.03315.58

preferences:
54.85 ms | 401 KiB | 5 Q