3v4l.org

run code in 300+ PHP versions simultaneously
<?php function stringCheck_TypeSafe(string $string) { $pos = strpos($string, 'cat'); if ($pos === 0) { return true; } return false; } function stringCheck_NotTypeSafe($string) { $pos = strpos($string, 'cat'); if ($pos != 'true') { return true; } return false; } echo "type safe string check, return should be true:\n"; var_dump(stringCheck_TypeSafe('cat')); echo "not type safe string check, return should be true:\n"; var_dump(stringCheck_NotTypeSafe('cat')); echo "not type safe string check, return should be false:\n"; var_dump(stringCheck_NotTypeSafe('a'));

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.4.120.0140.00624.14
8.4.110.0140.01018.67
8.4.100.0070.00919.15
8.4.90.0100.00320.64
8.4.80.0030.00520.46
8.4.70.0180.00518.23
8.4.60.0060.00318.88
8.4.50.0130.00818.66
8.4.40.0180.00022.43
8.4.30.0110.00820.17
8.4.20.0090.00017.75
8.4.10.0110.00820.71
8.3.250.0090.00918.93
8.3.240.0050.00416.90
8.3.230.0120.00816.53
8.3.220.0120.00618.98
8.3.210.0120.00416.66
8.3.200.0060.00316.51
8.3.190.0120.00617.13
8.3.180.0100.00817.02
8.3.170.0030.01619.09
8.3.160.0060.00316.47
8.3.150.0120.00817.12
8.3.140.0070.01118.35
8.3.130.0080.00018.39
8.3.120.0060.00318.80
8.3.110.0030.00720.94
8.3.100.0040.00416.63
8.3.90.0030.00526.77
8.3.80.0040.00419.36
8.3.70.0040.01116.58
8.3.60.0120.00916.38
8.3.50.0110.01023.51
8.3.40.0070.00718.59
8.3.30.0070.01018.60
8.3.20.0050.00324.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0090.01020.50
8.2.280.0170.00318.52
8.2.270.0040.01417.47
8.2.260.0140.00716.48
8.2.250.0080.00016.78
8.2.240.0090.00618.98
8.2.230.0030.00522.58
8.2.220.0040.00424.06
8.2.210.0020.00526.77
8.2.200.0040.00418.88
8.2.190.0130.00716.58
8.2.180.0150.00625.92
8.2.170.0040.01118.95
8.2.160.0130.00022.96
8.2.150.0000.00825.66
8.2.140.0070.00024.66
8.2.130.0030.00526.16
8.2.120.0080.00026.35
8.2.110.0040.01422.16
8.2.100.0060.00617.78
8.2.90.0070.00020.59
8.2.80.0070.00417.97
8.2.70.0060.00317.92
8.2.60.0040.00417.79
8.2.50.0050.00518.07
8.2.40.0030.00617.91
8.2.30.0040.00418.14
8.2.20.0030.00617.98
8.2.10.0040.00419.30
8.2.00.0040.00419.30
8.1.330.0130.00522.13
8.1.320.0130.00617.84
8.1.310.0110.00016.05
8.1.300.0070.00016.43
8.1.290.0090.00030.84
8.1.280.0040.01125.92
8.1.270.0080.00023.99
8.1.260.0080.00028.09
8.1.250.0030.00628.09
8.1.240.0030.00723.77
8.1.230.0110.00020.88
8.1.220.0050.00317.74
8.1.210.0030.00619.01
8.1.200.0060.00317.23
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0040.00418.52
8.1.160.0040.00418.89
8.1.150.0000.00718.89
8.1.140.0080.00018.90
8.1.130.0030.00620.14
8.1.120.0070.00017.50
8.1.110.0000.00717.45
8.1.100.0080.00017.53
8.1.90.0000.00717.35
8.1.80.0040.00417.48
8.1.70.0030.00317.50
8.1.60.0000.00817.65
8.1.50.0030.00517.54
8.1.40.0060.00317.53
8.1.30.0000.00817.66
8.1.20.0030.00517.55
8.1.10.0000.00717.48
8.1.00.0040.00417.52
8.0.300.0070.00019.89
8.0.290.0040.00416.75
8.0.280.0030.00318.33
8.0.270.0000.00718.08
8.0.260.0030.00318.60
8.0.250.0070.00017.00
8.0.240.0050.00216.96
8.0.230.0030.00316.92
8.0.220.0000.00716.96
8.0.210.0070.00016.77
8.0.200.0000.00716.96
8.0.190.0000.00816.90
8.0.180.0080.00016.96
8.0.170.0090.00016.91
8.0.160.0000.00716.86
8.0.150.0000.00716.80
8.0.140.0040.00416.69
8.0.130.0000.00513.32
8.0.120.0000.00816.90
8.0.110.0000.00716.68
8.0.100.0070.00016.84
8.0.90.0000.00716.94
8.0.80.0120.00316.89
8.0.70.0030.00516.70
8.0.60.0000.00816.90
8.0.50.0040.00416.97
8.0.30.0120.00317.32
8.0.20.0120.00917.37
8.0.10.0040.00416.89
8.0.00.0130.00617.86
7.4.330.0030.00315.55
7.4.320.0000.00616.64
7.4.300.0000.00616.51
7.4.290.0000.00716.59
7.4.280.0050.00316.65
7.4.270.0000.00616.43
7.4.260.0000.00613.32
7.4.250.0050.00216.38
7.4.240.0000.00816.61
7.4.230.0030.00316.32
7.4.220.0040.00316.47
7.4.210.0050.01016.51
7.4.200.0000.00716.36
7.4.140.0100.01317.86
7.4.130.0110.00817.86
7.4.120.0060.01317.86
7.4.110.0070.01017.86
7.4.100.0130.00317.86
7.4.90.0100.00717.86
7.4.80.0100.00717.86
7.4.70.0090.00917.86
7.4.60.0090.00917.86
7.4.50.0070.01017.86
7.4.40.0100.00717.86
7.4.30.0130.00717.86
7.4.20.0070.01017.86
7.4.10.0100.00717.86
7.4.00.0040.01317.86
7.3.330.0040.00416.42
7.3.320.0030.00313.19
7.3.310.0070.00016.38
7.3.300.0030.00316.41
7.3.290.0060.00816.36
7.3.260.0060.01017.86
7.3.250.0180.00017.86
7.3.240.0070.01017.86
7.3.230.0090.00917.86
7.3.220.0070.01017.86
7.3.210.0060.00917.86
7.3.200.0060.01017.86
7.3.190.0140.00317.86
7.3.180.0100.00717.86
7.3.170.0100.00717.86
7.3.160.0060.01217.86
7.3.150.0090.00917.86
7.3.140.0090.00917.86
7.3.130.0100.00617.86
7.3.120.0030.01517.86
7.3.110.0070.01017.86
7.3.100.0100.01017.86
7.3.90.0040.01817.86
7.3.80.0100.01317.86
7.3.70.0130.00617.86
7.3.60.0060.01417.86
7.3.50.0170.00317.86
7.3.40.0110.01117.86
7.3.30.0070.01117.86
7.3.20.0110.00717.86
7.3.10.0250.02817.86
7.3.00.0080.00917.86

preferences:
28.43 ms | 403 KiB | 5 Q