3v4l.org

run code in 300+ PHP versions simultaneously
<?php $desc = "GLOVE EXAM BEST TCH ALOE LTX MED 10BX/CS 100/BX"; $uom = "CS"; $keywords = explode(" ", $desc); // print_r($keywords); $pkgstring = ""; $result = []; foreach ($keywords as $key => $keyword){ $firstchar = substr($keyword, 0, 1); if (is_numeric($firstchar)) { $pkgstring .= $keyword.","; } } $pkgstring = substr($pkgstring, 0, -1); echo $pkgstring."\n\n"; $result['pkgstring'] = $pkgstring; $str_ele = explode(",", $pkgstring); $qty_uom = 1; $new_arr = []; $pos = 1; if (stripos($pkgstring, $uom) !== false){ foreach ($str_ele as $key => $element) { if (stripos($element, '/') !== false) { $x = stripos($element, '/'); $chk = substr($element, $x-1, 1); if (is_numeric($chk)) { $new_arr[0] = $element; } else { $new_arr[$pos] = $element; $pos++; } } // // if (stripos($element, '/'.$uom) !== false) { // $x = stripos($element, '/'.$uom); // $chk = substr($element, $x-1, 1); // if (is_numeric($chk)) { // $size = substr($element, 0, $x); // $qty_uom *= $size; // break; // } // if (ctype_alpha($chk)) { // $new = preg_replace('/[^0-9]/', '', $element); // echo $new; // } // // } else { // // echo $element; // // } } print_r($new_arr); }

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.0060.00918.40
8.3.50.0100.00716.50
8.3.40.0000.01418.79
8.3.30.0100.00718.86
8.3.20.0040.00419.00
8.3.10.0040.00423.66
8.3.00.0070.00023.70
8.2.180.0070.00718.52
8.2.170.0140.00022.96
8.2.160.0120.00319.07
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0000.00820.47
8.2.120.0030.00526.35
8.2.110.0070.00320.44
8.2.100.0060.00618.03
8.2.90.0000.00919.30
8.2.80.0040.00417.97
8.2.70.0040.00418.05
8.2.60.0040.00417.93
8.2.50.0040.00418.10
8.2.40.0040.00419.33
8.2.30.0020.00519.33
8.2.20.0080.00018.21
8.2.10.0020.00519.34
8.2.00.0040.00419.44
8.1.280.0100.01025.92
8.1.270.0060.00322.05
8.1.260.0020.00526.35
8.1.250.0040.00428.09
8.1.240.0060.00321.04
8.1.230.0000.01018.88
8.1.220.0000.00817.76
8.1.210.0030.00618.77
8.1.200.0000.00917.35
8.1.190.0000.00817.22
8.1.180.0000.00918.10
8.1.170.0040.00418.87
8.1.160.0000.00718.89
8.1.150.0000.00718.91
8.1.140.0000.00719.64
8.1.130.0000.00719.04
8.1.120.0040.00417.38
8.1.110.0050.00217.38
8.1.100.0000.00717.42
8.1.90.0090.00017.35
8.1.80.0080.00017.54
8.1.70.0040.00417.42
8.1.60.0030.00617.62
8.1.50.0030.00617.54
8.1.40.0060.00317.38
8.1.30.0070.00417.65
8.1.20.0000.00717.59
8.1.10.0000.00717.60
8.1.00.0050.00317.50
8.0.300.0070.00018.77
8.0.290.0030.00516.75
8.0.280.0040.00418.47
8.0.270.0000.00717.29
8.0.260.0050.00317.39
8.0.250.0000.00717.00
8.0.240.0070.00016.99
8.0.230.0030.00316.88
8.0.220.0070.00016.90
8.0.210.0110.00016.89
8.0.200.0040.00416.88
8.0.190.0040.00416.97
8.0.180.0000.00816.88
8.0.170.0080.00016.93
8.0.160.0030.00316.98
8.0.150.0040.00416.89
8.0.140.0050.00216.87
8.0.130.0030.00313.33
8.0.120.0040.00416.91
8.0.110.0050.00316.91
8.0.100.0030.00516.79
8.0.90.0040.00416.81
8.0.80.0100.01116.94
8.0.70.0000.00816.79
8.0.60.0080.00016.98
8.0.50.0000.00716.92
8.0.30.0050.01217.13
8.0.20.0160.00317.40
8.0.10.0040.00417.07
8.0.00.0150.00416.88
7.4.330.0000.00415.55
7.4.320.0030.00316.56
7.4.300.0030.00316.51
7.4.290.0000.00716.57
7.4.280.0050.00316.63
7.4.270.0050.00316.64
7.4.260.0000.00716.53
7.4.250.0000.00816.50
7.4.240.0070.00016.49
7.4.230.0000.00816.67
7.4.220.0030.00516.64
7.4.210.0090.00616.60
7.4.200.0040.00416.43
7.4.160.0050.01116.59
7.4.140.0100.01117.86
7.4.130.0150.00816.45
7.4.120.0120.00816.56
7.4.110.0100.00716.31
7.4.100.0200.00616.51
7.4.90.0150.00916.35
7.4.80.0070.01119.39
7.4.70.0140.00616.46
7.4.60.0000.01616.64
7.4.50.0030.01416.60
7.4.40.0060.01016.60
7.4.10.0100.00315.20
7.4.00.0080.00615.00
7.3.330.0000.00513.22
7.3.320.0000.00613.24
7.3.310.0000.00716.39
7.3.300.0000.00716.25
7.3.290.0000.00716.25
7.3.280.0090.00616.41
7.3.260.0100.00716.48
7.3.240.0130.00916.54
7.3.230.0070.01016.42
7.3.210.0090.00916.49
7.3.200.0070.01316.40
7.3.190.0080.01216.36
7.3.180.0090.00616.44
7.3.170.0000.01616.67
7.3.160.0050.01316.46
7.3.130.0070.01015.11
7.3.120.0060.01314.59
7.3.110.0090.00914.87
7.3.100.0040.01214.90
7.3.90.0100.00314.81
7.3.80.0030.01014.88
7.3.70.0040.00814.89
7.3.60.0060.00914.85
7.3.50.0040.00414.91
7.3.40.0030.00514.63
7.3.30.0030.01314.98
7.3.20.0030.00916.83
7.3.10.0070.00316.55
7.3.00.0090.00416.70
7.2.330.0030.01516.83
7.2.320.0130.01016.45
7.2.310.0070.01116.85
7.2.300.0080.00816.75
7.2.290.0080.00816.39
7.2.260.0060.01214.86
7.2.250.0070.01115.14
7.2.240.0040.01114.84
7.2.230.0000.01415.13
7.2.220.0040.01115.05
7.2.210.0030.01015.07
7.2.200.0120.00015.30
7.2.190.0000.01514.81
7.2.180.0030.00615.03
7.2.170.0060.00915.09
7.2.160.0070.00714.75
7.2.150.0030.00816.89
7.2.140.0100.00316.94
7.2.130.0090.00317.00
7.2.120.0130.00316.69
7.2.110.0080.00816.98
7.2.100.0060.00917.04
7.2.90.0090.00616.97
7.2.80.0080.01115.68
7.2.70.0070.00915.93
7.2.60.0140.00815.75
7.2.50.0050.01015.96
7.2.40.0050.01515.88
7.2.30.0100.00515.89
7.2.20.0120.00616.10
7.2.10.0090.00815.94
7.2.00.0110.00916.03
7.1.330.0030.01016.06
7.1.320.0120.00315.46
7.1.310.0000.00915.90
7.1.300.0050.00315.55
7.1.290.0060.01015.55
7.1.280.0070.00715.91
7.1.270.0030.00515.86
7.1.260.0070.00715.83
7.1.250.0060.00915.96
7.1.240.0000.00915.86
7.1.230.0070.00315.81
7.1.220.0060.00615.58
7.1.210.0060.00615.91
7.1.200.0120.01115.61
7.1.190.0090.00814.83
7.1.180.0090.01014.70
7.1.170.0090.00614.86
7.1.160.0070.01014.88
7.1.150.0100.00514.87
7.1.140.0090.00514.84
7.1.130.0040.00814.90
7.1.120.0120.00514.85
7.1.110.0130.00314.82
7.1.100.0140.00814.98
7.1.90.0120.00714.77
7.1.80.0150.00314.83
7.1.70.0130.00714.89
7.1.60.0240.00923.84
7.1.50.0160.00823.84
7.1.40.0140.01023.92
7.1.30.0170.00723.62
7.1.20.0160.00923.78
7.1.10.0120.00514.82
7.1.00.0090.01214.85
7.0.330.0000.01115.38
7.0.320.0070.00715.41
7.0.310.0110.00415.41
7.0.300.0040.00815.52
7.0.290.0070.00715.18
7.0.280.0030.00715.14
7.0.270.0080.00615.21
7.0.260.0070.00315.60
7.0.250.0110.00415.43
7.0.240.0040.00415.42
7.0.230.0000.01115.20
7.0.220.0060.00615.48
7.0.210.0090.00315.53
7.0.200.0100.00715.54
7.0.190.0030.01015.41
7.0.180.0110.00415.27
7.0.170.0000.01215.55
7.0.160.0070.01015.55
7.0.150.0070.00715.38
7.0.140.0080.00415.23
7.0.130.0030.01415.54
7.0.120.0110.00415.52
7.0.110.0030.01015.49
7.0.100.0050.00315.35
7.0.90.0090.00415.47
7.0.80.0030.01015.52
7.0.70.0100.00315.42
7.0.60.0040.01115.41
7.0.50.0060.00615.19
7.0.40.0030.01013.51
7.0.30.0090.00613.42
7.0.20.0070.00713.62
7.0.10.0060.00613.59
7.0.00.0110.00413.40
5.6.400.0080.00514.66
5.6.390.0060.00714.25
5.6.380.0040.00814.80
5.6.370.0040.00714.10
5.6.360.0000.00914.23
5.6.350.0000.01614.64
5.6.340.0060.00314.21
5.6.330.0030.00614.38
5.6.320.0090.00614.43
5.6.310.0090.00314.44
5.6.300.0070.01014.25
5.6.290.0070.00714.36
5.6.280.0000.01414.16
5.6.270.0070.00714.55
5.6.260.0100.00314.41
5.6.250.0040.01114.62
5.6.240.0000.01314.75
5.6.230.0040.00414.76
5.6.220.0080.00814.36
5.6.210.0090.00614.34
5.6.200.0070.00714.54
5.6.190.0040.01114.51
5.6.180.0140.00014.29
5.6.170.0030.00614.29
5.6.160.0030.01014.47
5.6.150.0060.01014.36
5.6.140.0030.00614.28
5.6.130.0060.00314.73
5.6.120.0040.00714.38
5.6.110.0060.00614.54
5.6.100.0080.00414.24
5.6.90.0090.00314.28
5.6.80.0000.00914.45
5.6.70.0060.00314.09
5.6.60.0100.00714.61
5.6.50.0000.01114.63
5.6.40.0040.00814.28
5.6.30.0100.00314.26
5.6.20.0040.00814.30
5.6.10.0030.00714.31
5.6.00.0040.01114.41

preferences:
57.69 ms | 400 KiB | 5 Q