3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = '8000000'; $data = substr($data, 2); //remove the 0x prefix from the string $data = str_replace(' ', '', $data); //remove the spaces from the string //$data is now '11210031' echo 'the product number is ' . $data[0] . "\n"; if ($data[1] == 1) { echo "this is a new product\n"; } else if ($data[1] == 2) { echo "this is a used product\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.0180.00416.63
8.3.50.0090.00916.31
8.3.40.0120.00318.51
8.3.30.0110.00418.70
8.3.20.0050.00224.18
8.3.10.0040.00424.66
8.3.00.0000.00826.16
8.2.180.0070.01125.92
8.2.170.0080.00819.06
8.2.160.0070.00722.96
8.2.150.0050.00325.66
8.2.140.0000.00824.66
8.2.130.0050.00326.16
8.2.120.0040.00426.35
8.2.110.0050.00520.35
8.2.100.0080.00317.78
8.2.90.0030.00517.75
8.2.80.0030.00518.76
8.2.70.0080.00418.16
8.2.60.0040.00418.22
8.2.50.0000.00918.10
8.2.40.0040.00421.19
8.2.30.0040.00719.30
8.2.20.0050.00317.99
8.2.10.0070.00019.30
8.2.00.0040.00419.27
8.1.280.0090.00925.92
8.1.270.0050.00323.99
8.1.260.0070.00328.09
8.1.250.0070.00028.09
8.1.240.0000.01022.19
8.1.230.0070.00422.15
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0050.00317.13
8.1.180.0050.00318.10
8.1.170.0000.00818.66
8.1.160.0040.00418.78
8.1.150.0040.00418.93
8.1.140.0000.00718.88
8.1.130.0030.00320.20
8.1.120.0050.00317.34
8.1.110.0000.01117.33
8.1.100.0070.00017.36
8.1.90.0000.00717.48
8.1.80.0040.00417.50
8.1.70.0080.00017.45
8.1.60.0040.00417.56
8.1.50.0060.00317.49
8.1.40.0050.00217.50
8.1.30.0000.00817.65
8.1.20.0080.00017.66
8.1.10.0040.00417.52
8.1.00.0080.00017.36
8.0.300.0000.00818.77
8.0.290.0030.00616.63
8.0.280.0030.00318.37
8.0.270.0050.00316.75
8.0.260.0000.00618.44
8.0.250.0040.00416.95
8.0.240.0040.00416.84
8.0.230.0000.00716.98
8.0.220.0050.00316.78
8.0.210.0000.00816.89
8.0.200.0040.00416.88
8.0.190.0040.00416.96
8.0.180.0000.00716.79
8.0.170.0060.00316.91
8.0.160.0040.00416.94
8.0.150.0000.00716.82
8.0.140.0000.00716.82
8.0.130.0000.00613.25
8.0.120.0050.00316.90
8.0.110.0040.00416.86
8.0.100.0040.00416.83
8.0.90.0040.00416.72
8.0.80.0120.00516.90
8.0.70.0000.00816.77
8.0.60.0050.00216.83
8.0.50.0000.00716.77
8.0.30.0250.00616.82
8.0.20.0220.00816.87
8.0.10.0060.01216.89
8.0.00.0210.01016.91
7.4.330.0020.00215.55
7.4.320.0030.00316.50
7.4.300.0030.00316.43
7.4.290.0040.00416.45
7.4.280.0000.00816.40
7.4.270.0030.00316.40
7.4.260.0000.00513.27
7.4.250.0030.00316.56
7.4.240.0020.00616.51
7.4.230.0000.00716.68
7.4.220.0050.00216.60
7.4.210.0100.00616.60
7.4.200.0070.00016.31
7.4.160.0210.00516.39
7.4.150.0140.00616.49
7.4.140.0520.01216.43
7.4.130.0140.00716.41
7.4.120.0160.00616.36
7.4.110.0110.01116.55
7.4.100.0230.00916.56
7.4.90.0080.01216.58
7.4.80.0210.00516.23
7.4.70.0130.00916.41
7.4.60.0170.00616.38
7.4.50.0120.01716.26
7.4.40.0120.01216.40
7.4.30.0140.01316.41
7.4.20.0220.00316.39
7.4.10.0040.01816.37
7.4.00.0240.01216.45
7.3.330.0040.00416.27
7.3.320.0000.00513.24
7.3.310.0000.00716.22
7.3.300.0000.00616.17
7.3.290.0070.00916.21
7.3.280.0410.00616.05
7.3.270.0140.00316.07
7.3.260.0150.01816.16
7.3.250.0160.00516.19
7.3.240.0210.00316.02
7.3.230.0160.00416.06
7.3.220.0220.01116.11
7.3.210.0150.00716.11
7.3.200.0100.01516.15
7.3.190.0190.00316.05
7.3.180.0120.00816.29
7.3.170.0160.01116.08
7.3.160.0140.01415.91
7.3.150.0120.01216.04
7.3.140.0150.00616.18
7.3.130.0150.01216.08
7.3.120.0170.01016.10
7.3.110.0230.00816.00
7.3.100.0160.00316.10
7.3.90.0160.01016.34
7.3.80.0370.00916.02
7.3.70.0170.01416.26
7.3.60.0250.00716.41
7.3.50.0190.00516.37
7.3.40.0130.00816.34
7.3.30.0200.00316.27
7.3.20.0310.00916.26
7.3.10.0200.00616.25
7.3.00.0110.01116.25

preferences:
61.7 ms | 401 KiB | 5 Q