3v4l.org

run code in 300+ PHP versions simultaneously
<?php $urls = [ 'www.example.com/myurl.html?unwantedthngs#hastag', 'www.example.com/myurl.html' ]; foreach ($urls as $url) { var_export(['strtok: ', strtok($url, '?')]); echo "\n"; var_export(['strstr/true: ', strstr($url, '?', true)]); // not reliable echo "\n"; var_export(['explode/2: ', explode('?', $url, 2)[0]]); // limit alls func to stop searching after first encounter echo "\n"; var_export(['substr/strrpos: ', substr($url, 0, strrpos( $url, "?"))]); // not reliable; still not with strpos() echo "\n---\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.4.20.0030.00717.78
8.4.10.0120.00819.40
8.3.150.0130.00617.27
8.3.140.0040.00419.11
8.3.130.0060.00318.32
8.3.120.0070.00418.84
8.3.110.0000.00820.94
8.3.100.0000.00916.40
8.3.90.0040.01126.77
8.3.80.0090.00018.43
8.3.70.0090.00916.75
8.3.60.0150.00616.50
8.3.50.0100.00823.58
8.3.40.0040.01118.66
8.3.30.0080.00818.76
8.3.20.0120.00825.19
8.3.10.0050.00822.98
8.3.00.0050.00923.14
8.2.270.0040.01516.85
8.2.260.0030.00518.67
8.2.250.0000.00716.48
8.2.240.0090.00017.09
8.2.230.0050.00222.58
8.2.220.0060.00624.06
8.2.210.0150.00026.77
8.2.200.0070.00316.63
8.2.190.0040.01116.58
8.2.180.0060.01025.92
8.2.170.0070.00718.90
8.2.160.0130.00722.96
8.2.150.0110.00825.66
8.2.140.0110.00225.16
8.2.130.0130.00025.91
8.2.120.0070.00622.81
8.2.110.0090.00522.53
8.2.100.0080.00821.75
8.2.90.0030.01022.53
8.2.80.0070.00723.16
8.2.70.0060.00821.85
8.2.60.0090.00522.00
8.2.50.0120.00221.09
8.2.40.0080.00622.08
8.2.30.0050.01121.51
8.2.20.0030.01021.10
8.2.10.0080.00621.43
8.2.00.0110.00321.45
8.1.310.0040.01416.52
8.1.300.0040.00418.04
8.1.290.0030.00618.88
8.1.280.0070.01425.92
8.1.270.0070.00925.25
8.1.260.0080.00626.01
8.1.250.0070.00426.88
8.1.240.0070.00523.87
8.1.230.0110.00523.35
8.1.220.0100.00721.70
8.1.210.0090.00422.27
8.1.200.0110.00321.51
8.1.190.0090.00321.45
8.1.180.0060.00721.09
8.1.170.0080.00521.23
8.1.160.0080.00621.96
8.1.150.0090.00421.33
8.1.140.0120.00121.33
8.1.130.0100.00220.88
8.1.120.0100.00320.83
8.1.110.0090.00420.83
8.1.100.0050.00820.84
8.1.90.0080.00420.86
8.1.80.0060.00620.87
8.1.70.0070.00519.14
8.1.60.0130.00220.05
8.1.50.0090.00620.05
8.1.40.0080.00720.04
8.1.30.0100.00520.05
8.1.20.0100.00420.09
8.1.10.0080.00720.06
8.1.00.0080.00720.04
8.0.300.0070.00422.84
8.0.290.0170.00421.21
8.0.280.0110.00921.17
8.0.270.0080.00721.24
8.0.260.0100.00620.64
8.0.250.0090.00520.71
8.0.240.0140.00220.72
8.0.230.0130.00520.72
8.0.220.0120.00220.69
8.0.210.0080.00820.68
8.0.200.0120.00319.71
8.0.190.0110.00619.76
8.0.180.0070.00719.70
8.0.170.0150.00419.73
8.0.160.0100.00519.71
8.0.150.0120.00619.70
8.0.140.0120.00619.68
8.0.130.0130.00318.81
8.0.120.0150.00219.73
8.0.110.0100.00419.70
8.0.100.0140.00419.72
8.0.90.0140.00619.73
8.0.80.0090.00819.10
8.0.70.0090.00519.74
8.0.60.0150.00219.71
8.0.50.0130.00419.68
8.0.30.0130.00619.73
8.0.20.0070.01019.20
8.0.10.0140.00319.75
8.0.00.0160.00319.72
7.4.330.0100.00320.24
7.4.320.0120.00520.56
7.4.300.0100.00719.53
7.4.290.0120.00719.60
7.4.280.0110.00619.52
7.4.270.0140.00319.58
7.4.260.0080.00818.72
7.4.250.0110.00719.55
7.4.240.0100.00418.96
7.4.230.0130.00319.61
7.4.220.0100.00618.91
7.4.210.0080.01018.31
7.4.200.0110.00719.48
7.4.190.0170.00320.59
7.4.180.0150.00720.55
7.4.160.0120.00920.42
7.4.150.0120.00820.51
7.4.140.0120.00620.36
7.4.130.0120.00718.84
7.4.120.0110.00619.52
7.4.110.0130.00719.52
7.4.100.0120.00619.51
7.4.90.0120.00519.50
7.4.80.0120.00620.20
7.4.70.0110.00719.45
7.4.60.0130.00719.53
7.4.50.0140.00319.41
7.4.40.0140.00519.37
7.4.30.0180.00818.86
7.4.20.0130.00718.81
7.4.10.0130.00818.86
7.4.00.0130.01018.87
7.3.330.0160.00319.35
7.3.320.0140.00318.63
7.3.310.0150.00419.41
7.3.300.0150.00219.45
7.3.290.0100.00918.38
7.3.280.0180.00420.45
7.3.270.0130.00920.47
7.3.260.0150.00919.50
7.3.250.0150.00420.48
7.3.240.0120.00820.49
7.3.230.0130.00519.47
7.3.220.0180.00320.48
7.3.210.0100.00919.47
7.3.200.0140.00619.42
7.3.190.0150.00419.48
7.3.180.0130.00619.45
7.3.170.0140.00619.46
7.3.160.0150.00619.32
7.3.150.0160.00418.85
7.3.140.0150.00618.76
7.3.130.0120.00818.73
7.3.120.0180.00418.76
7.3.110.0110.00818.86
7.3.100.0130.00818.84
7.3.90.0140.00818.86
7.3.80.0160.00518.86
7.3.70.0140.00718.82
7.3.60.0120.00818.85
7.3.50.0140.00618.81
7.3.40.0100.00918.87
7.3.30.0150.00618.86
7.3.20.0160.00419.21
7.3.10.0120.00819.25
7.3.00.0110.00919.17
7.2.340.0150.00520.55
7.2.330.0140.00619.55
7.2.320.0150.00519.50
7.2.310.0150.00519.53
7.2.300.0120.00919.58
7.2.290.0130.00819.47
7.2.280.0130.01018.85
7.2.270.0120.00918.88
7.2.260.0130.00618.88
7.2.250.0130.00818.75
7.2.240.0130.00818.97
7.2.230.0130.00718.90
7.2.220.0140.00618.91
7.2.210.0120.01018.96
7.2.200.0150.00718.94
7.2.190.0150.00818.88
7.2.180.0130.00718.91
7.2.170.0120.01019.02
7.2.160.0130.00718.91
7.2.150.0130.00819.29
7.2.140.0140.00819.37
7.2.130.0140.00919.36
7.2.120.0140.00719.41
7.2.110.0120.00819.39
7.2.100.0260.00719.30
7.2.90.0180.00919.33
7.2.80.0160.00519.36
7.2.70.0150.00719.34
7.2.60.0150.00519.40
7.2.50.0100.00919.34
7.2.40.0120.00819.33
7.2.30.0130.00919.33
7.2.20.0110.01019.32
7.2.10.0140.00719.34
7.2.00.0130.00819.38

preferences:
27.42 ms | 403 KiB | 5 Q