3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Find substring starting in string, starting from some symbol(s) * @param string $haystack * @param string $needle * @return string */ function my_strstr(string $haystack, string $needle): string { for($i = 0; $i < strlen($haystack); $i++) { if($haystack[$i] == $needle[0]) { $eq = true; for($j = 0; $j < strlen($needle); $j++) { if($haystack[$i + $j] !== $needle[$j]) { $eq = false; break; } } if($eq) { return substr($haystack, $i); } } } } var_dump(my_strstr('asdfghend', 'fg')); // 'fghend';

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.5.00.0040.00520.05
8.4.150.0010.00114.05
8.4.140.0140.00717.66
8.4.130.0130.00817.63
8.4.120.0090.00720.88
8.4.110.0140.00522.60
8.4.100.0110.00917.41
8.4.90.0130.00722.23
8.4.80.0100.01017.75
8.4.70.0120.00617.94
8.4.60.0110.01118.69
8.4.50.0090.01018.65
8.4.40.0120.00817.79
8.4.30.0150.00420.72
8.4.20.0130.00622.68
8.4.10.0000.00824.00
8.3.280.0100.01018.42
8.3.270.0160.00716.41
8.3.260.0120.00816.58
8.3.250.0100.01018.93
8.3.240.0120.00717.20
8.3.230.0100.00216.43
8.3.220.0090.00919.11
8.3.210.0120.00616.56
8.3.200.0050.00316.50
8.3.190.0100.00817.09
8.3.180.0100.00918.80
8.3.170.0130.00717.38
8.3.160.0060.01318.27
8.3.150.0170.00320.90
8.3.140.0070.01020.76
8.3.130.0080.00018.61
8.3.120.0090.00918.88
8.3.110.0040.00420.94
8.3.100.0090.00024.06
8.3.90.0080.00026.77
8.3.80.0050.00518.40
8.3.70.0090.00616.71
8.3.60.0140.00718.55
8.3.50.0040.01116.60
8.3.40.0070.00721.68
8.3.30.0040.01119.23
8.3.20.0070.00024.18
8.3.10.0080.00024.66
8.3.00.0090.00026.16
8.2.290.0080.01120.57
8.2.280.0040.00518.42
8.2.270.0110.00716.66
8.2.260.0050.00317.52
8.2.250.0110.00716.54
8.2.240.0150.00318.83
8.2.230.0040.00422.58
8.2.220.0090.00037.54
8.2.210.0040.00426.77
8.2.200.0030.00618.17
8.2.190.0100.00616.75
8.2.180.0160.00316.63
8.2.170.0100.00318.82
8.2.160.0030.01022.96
8.2.150.0080.00025.66
8.2.140.0140.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00822.19
8.2.110.0030.00719.17
8.2.100.0110.00017.84
8.2.90.0200.01217.48
8.2.80.0270.00717.25
8.2.70.0220.00417.50
8.2.60.0200.01017.38
8.2.50.0310.00017.38
8.2.40.0200.00817.50
8.2.30.0150.01217.38
8.2.20.0240.00317.50
8.2.10.0250.00317.00
8.2.00.0240.00617.25
8.1.330.0110.00822.04
8.1.320.0040.00716.26
8.1.310.0100.00716.77
8.1.300.0030.00618.15
8.1.290.0060.00330.84
8.1.280.0070.00725.92
8.1.270.0060.00324.02
8.1.260.0030.00526.35
8.1.250.0050.00328.09
8.1.240.0060.00322.56
8.1.230.0060.00620.97
8.1.220.0220.00717.25
8.1.210.0220.00417.11
8.1.200.0220.01017.00
8.1.190.0230.00617.00
8.1.180.0240.00316.86
8.1.170.0200.00717.13
8.1.160.0210.00616.84
8.1.150.0270.00216.88
8.1.140.0210.00717.00
8.1.130.0250.00316.75
8.1.120.0240.00416.99
8.1.110.0280.00017.11
8.1.100.0210.00617.34
8.1.90.0210.00817.00
8.1.80.0170.01016.75
8.1.70.0250.00416.75
8.1.60.0240.00617.00
8.1.50.0240.00317.00
8.1.40.0260.00017.38
8.1.30.0230.00417.35
8.1.20.0200.00917.10
8.1.10.0330.00017.00
8.1.00.0280.00017.13
8.0.300.0290.00016.48
8.0.290.0220.01116.37
8.0.280.0240.00316.37
8.0.270.0240.00316.37
8.0.260.0200.00716.37
8.0.250.0250.00316.37
8.0.240.0220.00616.37
8.0.230.0250.00416.63
8.0.220.0260.00516.37
8.0.210.0250.00016.50
8.0.200.0280.00016.38
8.0.190.0280.00416.48
8.0.180.0260.00316.75
8.0.170.0210.00616.49
8.0.160.0240.00416.74
8.0.150.0270.00016.63
8.0.140.0250.00516.37
8.0.130.0280.00016.37
8.0.120.0260.00416.37
8.0.110.0210.00616.37
8.0.100.0220.00616.50
8.0.90.0220.00516.63
8.0.80.0240.00316.63
8.0.70.0250.00416.50
8.0.60.0230.00316.37
8.0.50.0250.00016.49
8.0.30.0190.00616.74
8.0.20.0220.00616.50
8.0.10.0290.00016.72

preferences:
28.27 ms | 403 KiB | 5 Q