3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_numerics ($str) { preg_match_all('/\d+/', $str, $matches); return $matches[0]; } $input = 'bubur 98k'; $inputNumbers = get_numerics($input); if (count($inputNumbers) !== 1) { // lebih dari 1 angka, atau angka null print_r("formatnya yang bener dong."); } else { $tempExpense = $inputNumbers[0]; // get index of first number occurence $pos = strpos($input, (string)$tempExpense); $k = ""; if (substr($input, $pos+1,1) === 'k') { // 3k $expense = $tempExpense * 1000; } elseif (substr($input, $pos+1,1) === '.') { // 100.300 } else { // 5000 $expense = $tempExpense; } print_r($tempExpense."k \n"); print_r($expense); }

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.0070.00718.43
8.3.50.0110.00418.42
8.3.40.0060.00918.87
8.3.30.0090.00618.72
8.3.20.0060.00320.13
8.3.10.0040.00422.14
8.3.00.0030.00523.48
8.2.180.0120.00416.38
8.2.170.0070.01422.96
8.2.160.0100.00322.29
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00420.51
8.2.120.0090.00026.35
8.2.110.0030.00620.98
8.2.100.0080.00418.09
8.2.90.0000.00919.21
8.2.80.0000.00818.04
8.2.70.0050.00317.88
8.2.60.0080.00018.04
8.2.50.0040.00418.22
8.2.40.0040.00420.59
8.2.30.0000.00719.28
8.2.20.0000.00818.13
8.2.10.0030.00618.26
8.2.00.0040.00418.03
8.1.280.0060.01225.92
8.1.270.0030.00520.60
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0100.00021.14
8.1.230.0060.00617.76
8.1.220.0030.00517.88
8.1.210.0030.00518.77
8.1.200.0050.00517.36
8.1.190.0040.00417.36
8.1.180.0060.00318.10
8.1.170.0080.00018.77
8.1.160.0000.00718.85
8.1.150.0000.00720.22
8.1.140.0040.00417.65
8.1.130.0070.00018.95
8.1.120.0000.00717.52
8.1.110.0000.00817.66
8.1.100.0040.00417.61
8.1.90.0020.00517.48
8.1.80.0070.00017.61
8.1.70.0040.00417.50
8.1.60.0090.00017.70
8.1.50.0080.00017.63
8.1.40.0040.00417.69
8.1.30.0000.00817.88
8.1.20.0050.00317.68
8.1.10.0040.00417.68
8.1.00.0030.00617.68
8.0.300.0030.00618.77
8.0.290.0000.00716.88
8.0.280.0000.00718.48
8.0.270.0070.00017.20
8.0.260.0000.00618.60
8.0.250.0040.00417.16
8.0.240.0040.00417.09
8.0.230.0030.00317.02
8.0.220.0040.00417.13
8.0.210.0040.00417.04
8.0.200.0030.00317.09
8.0.190.0030.00616.99
8.0.180.0000.00817.02
8.0.170.0040.00417.05
8.0.160.0030.00517.11
8.0.150.0000.00716.97
8.0.140.0040.00416.97
8.0.130.0050.00013.52
8.0.120.0040.00416.94
8.0.110.0080.00017.08
8.0.100.0070.00016.98
8.0.90.0000.00817.04
8.0.80.0040.01117.10
8.0.70.0030.00516.99
8.0.60.0070.00017.00
8.0.50.0030.00517.11
8.0.30.0110.00817.45
8.0.20.0110.00717.40
8.0.10.0040.00417.20
8.0.00.0110.00716.99
7.4.330.0000.00515.55
7.4.320.0040.00416.81
7.4.300.0000.00616.71
7.4.290.0080.00316.66
7.4.280.0060.00316.84
7.4.270.0030.00416.73
7.4.260.0000.00716.88
7.4.250.0080.00016.77
7.4.240.0040.00416.72
7.4.230.0030.00316.58
7.4.220.0100.01016.59
7.4.210.0070.00716.85
7.4.200.0030.00316.61
7.4.160.0060.01116.70
7.4.150.0090.00917.40
7.4.140.0120.01017.86
7.4.130.0070.01016.68
7.4.120.0080.01016.79
7.4.110.0150.00416.78
7.4.100.0090.00916.55
7.4.90.0110.00716.82
7.4.80.0120.00919.39
7.4.70.0120.01216.79
7.4.60.0100.00616.70
7.4.50.0030.01316.63
7.4.40.0030.01316.73
7.4.30.0130.00316.74
7.4.00.0070.00515.07
7.3.330.0000.00513.42
7.3.320.0050.00013.52
7.3.310.0040.00416.47
7.3.300.0040.00416.38
7.3.290.0080.00816.45
7.3.280.0080.00916.49
7.3.270.0060.01217.40
7.3.260.0130.00716.63
7.3.250.0100.00816.56
7.3.240.0110.00816.67
7.3.230.0060.01116.57
7.3.210.0090.00916.55
7.3.200.0090.00916.73
7.3.190.0000.01616.60
7.3.180.0060.01016.81
7.3.170.0070.01016.53
7.3.160.0140.00316.45
7.3.120.0090.00915.14
7.3.110.0100.00615.24
7.3.100.0060.00615.27
7.3.90.0030.01315.25
7.3.80.0100.00714.93
7.3.70.0000.00914.87
7.3.60.0000.01114.75
7.3.50.0070.00314.92
7.3.40.0070.00715.14
7.3.30.0090.00615.16
7.3.20.0000.01616.88
7.3.10.0070.00716.95
7.3.00.0030.01116.72
7.2.330.0100.00716.85
7.2.320.0070.01116.89
7.2.310.0090.00916.77
7.2.300.0030.01417.02
7.2.290.0090.00616.69
7.2.250.0030.01615.00
7.2.240.0000.01715.43
7.2.230.0120.00315.30
7.2.220.0060.00315.20
7.2.210.0080.00315.10
7.2.200.0040.00715.39
7.2.190.0070.01015.29
7.2.180.0030.00615.09
7.2.170.0060.00915.29
7.2.130.0100.00316.91
7.2.120.0040.00717.11
7.2.110.0090.00916.86
7.2.100.0070.00716.96
7.2.90.0150.00016.98
7.2.80.0080.00817.17
7.2.70.0120.00017.08
7.2.60.0020.00716.88
7.2.50.0060.00617.15
7.2.40.0060.00617.12
7.2.30.0030.00716.98
7.2.20.0100.00317.04
7.2.10.0070.00717.22
7.2.00.0030.00616.78
7.1.330.0030.00915.86
7.1.320.0030.01016.02
7.1.310.0070.00315.61
7.1.300.0030.01016.21
7.1.290.0080.00315.98
7.1.280.0080.00616.19
7.1.270.0040.00715.75
7.1.260.0070.00716.02
7.1.250.0030.00916.00
7.1.200.0040.00815.95
7.1.100.2500.00916.82
7.1.90.2740.01016.52
7.1.80.2730.00316.73
7.1.70.0080.01215.52
7.1.60.2530.01333.73
7.1.50.0270.01333.25
7.1.40.1730.01632.83
7.1.30.1800.01333.06
7.1.20.0350.01433.09
7.1.10.1630.01015.14
7.1.00.0140.01415.16
7.0.240.2530.00716.04
7.0.230.2180.00716.25
7.0.220.0080.01516.25
7.0.210.0080.01115.23
7.0.200.2450.01015.26
7.0.190.0100.01315.31
7.0.180.0150.01214.59
7.0.170.1660.01414.60
7.0.160.0150.00814.70
7.0.150.1760.00714.88
7.0.140.1350.01014.72
7.0.130.1530.00915.09
7.0.120.0160.01315.09
7.0.110.0050.01314.66
7.0.100.0150.00814.83
7.0.90.1520.00914.72
7.0.80.1450.00614.64
7.0.70.1510.00314.87
7.0.60.0110.00714.64
7.0.50.0240.01714.89
7.0.40.2070.01014.86
7.0.30.1660.01614.80
7.0.20.3120.01014.77
7.0.10.2230.01314.78
7.0.00.2240.01014.75

preferences:
72.71 ms | 400 KiB | 5 Q