3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '15_some_text_or_numbers'; var_dump( sscanf($string, '%d')[0], (int) $string, preg_replace('/^\d+\K.*/', '', $string), preg_match('/^\d+/', $string, $m) ? $m[0] : null, strstr($string . '_', '_', true), // append an underscore to the input if not guaranteed explode('_', $string, 2)[0], // the limit parameter prevents needeless explosions strtok($string, '_') );

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.30.0060.01020.16
8.5.20.0080.00918.70
8.5.10.0130.01016.87
8.5.00.0110.00920.38
8.4.180.0130.00922.08
8.4.170.0120.01020.33
8.4.160.0190.00721.64
8.4.150.0020.00014.05
8.4.140.0140.00818.03
8.4.130.0060.00618.11
8.4.120.0050.00422.40
8.4.110.0050.00522.66
8.4.100.0150.00618.03
8.4.90.0080.01020.55
8.4.80.0110.00818.98
8.4.70.0070.00218.93
8.4.60.0100.00920.64
8.4.50.0110.01018.93
8.4.40.0120.00917.82
8.4.30.0070.00718.82
8.4.20.0120.00920.08
8.4.10.0040.00419.44
8.3.300.0120.01018.58
8.3.290.0080.01220.77
8.3.280.0100.01220.52
8.3.270.0120.00816.67
8.3.260.0130.00616.41
8.3.250.0110.00918.84
8.3.240.0080.00216.61
8.3.230.0110.00816.77
8.3.220.0130.00619.02
8.3.210.0050.00316.60
8.3.200.0050.00416.79
8.3.190.0120.00717.28
8.3.180.0090.01018.91
8.3.170.0110.00718.73
8.3.160.0120.00320.69
8.3.150.0040.01516.66
8.3.140.0180.00016.75
8.3.130.0030.00618.70
8.3.120.0030.00619.06
8.3.110.0050.00520.94
8.3.100.0070.01324.06
8.3.90.0040.01126.77
8.3.80.0030.00617.97
8.3.70.0130.01016.63
8.3.60.0060.01018.30
8.3.50.0120.00918.72
8.3.40.0160.00322.18
8.3.30.0100.00319.09
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0080.00026.16
8.2.300.0070.01322.16
8.2.290.0120.00816.84
8.2.280.0150.00418.78
8.2.270.0060.00316.79
8.2.260.0070.01116.92
8.2.250.0080.00018.63
8.2.240.0060.00318.90
8.2.230.0000.01022.58
8.2.220.0040.01137.54
8.2.210.0000.00926.77
8.2.200.0140.00016.59
8.2.190.0110.00418.54
8.2.180.0180.00616.63
8.2.170.0120.00819.04
8.2.160.0100.00322.96
8.2.150.0000.00725.66
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00421.13
8.2.110.0070.00321.10
8.2.100.0320.00418.44
8.2.90.0270.00318.44
8.2.80.0150.01518.44
8.2.70.0230.00818.44
8.2.60.0220.00618.44
8.2.50.0300.00018.44
8.2.40.0270.00018.44
8.2.30.0280.00018.44
8.2.20.0230.00718.44
8.2.10.0250.00418.44
8.2.00.0180.00918.44
8.1.340.0080.01217.71
8.1.330.0100.01016.62
8.1.320.0190.00916.43
8.1.310.0150.00318.41
8.1.300.0050.00518.53
8.1.290.0060.00630.84
8.1.280.0070.01025.92
8.1.270.0000.00824.66
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0030.00619.59
8.1.230.0250.00418.44
8.1.220.0270.00318.44
8.1.210.0300.00318.44
8.1.200.0160.01218.44
8.1.190.0210.00718.44
8.1.180.0220.00618.44
8.1.170.0190.00818.44
8.1.160.0220.00618.44
8.1.150.0200.00718.44
8.1.140.0280.00418.44
8.1.130.0220.00418.44
8.1.120.0220.00318.44
8.1.110.0220.00418.44
8.1.100.0270.00018.44
8.1.90.0250.00018.44
8.1.80.0200.00718.44
8.1.70.0180.01018.44
8.1.60.0210.00718.44
8.1.50.0240.00318.44
8.1.40.0270.00018.44
8.1.30.0250.00318.44
8.1.20.0230.00418.44
8.1.10.0220.00418.44
8.1.00.0230.00018.44
8.0.300.0210.00718.44
8.0.290.0210.00618.44
8.0.280.0200.00718.44
8.0.270.0100.01718.44
8.0.260.0210.00618.44
8.0.250.0210.00718.44
8.0.240.0240.00318.44
8.0.230.0280.00018.44
8.0.220.0320.00018.44
8.0.210.0300.00018.44
8.0.200.0190.00718.44
8.0.190.0240.00518.44
8.0.180.0250.00418.44
8.0.170.0190.00818.44
8.0.160.0200.00718.44
8.0.150.0240.00418.44
8.0.140.0230.00618.44
8.0.130.0290.00018.44
8.0.120.0270.00018.44
8.0.110.0200.00718.44
8.0.100.0210.00418.44
8.0.90.0260.00018.44
8.0.80.0240.00418.44
8.0.70.0290.00018.44
8.0.60.0300.00018.44
8.0.50.0230.00618.44
8.0.30.0220.00618.44
8.0.20.0240.00318.44
8.0.10.0230.00418.44

preferences:
40.29 ms | 403 KiB | 5 Q