3v4l.org

run code in 300+ PHP versions simultaneously
<?php $time = "31d2h54"; $minutes = 0; $days = 0; $hours = 0; function lastinteger($string) { preg_match_all('((\d)+)',$string,$array); // echo "Taille du tableau trouve : " . count($array); // echo PHP_EOL, "CHaine du last integer " . $array[0] , PHP_EOL; // echo PHP_EOL, "var dump : " . var_dump($array[0]) ,PHP_EOL; $out = end($array[0]); echo "Valeur trouvé :" . $out, PHP_EOL; return $out[0]; } $length = strlen($time); $positionDays = strpos($time, "d"); echo $positionDays . ": Position des jours "; $positionHours = strpos($time, "h"); echo $positionHours . ": Position des heures "; $positionMinutes = strpos($time, "m"); echo $positionMinutes . ": Position des Minutes ", PHP_EOL; if ($positionDays === false) { } else { if (is_numeric(substr($time, $positionDays + 1 , $length - 1))) { $days += (intval(substr($time, $positionDays + 1, $length - 1)) / 60); } $days += lastinteger(substr($time, 0, $positionDays)); } if ($positionHours === false) { } else { if (is_numeric(substr($time, $positionHours + 1 , $length - 1))) { $hours += (intval(substr($time, $positionHours + 1, $length - 1)) / 60); } echo "chaine envoyé " . substr($time, 0, $positionHours), PHP_EOL; $hours += lastinteger(substr($time, 0, $positionHours)); } if ($positionMinutes === false) { } else { if(is_numeric(substr($time,$positionMinutes + 1,$length -1))) { $minutes += (intval(substr($time,$positionMinutes + 1,$length -1)) / 60); } $minutes += lastinteger(substr($time,0,$positionMinutes)); } echo "Temps : "; echo $minutes . " minutes "; echo $hours . " heures "; echo $days . " jours ";

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.70.0110.00716.88
8.3.60.0120.00318.43
8.3.50.0070.00718.44
8.3.40.0040.01118.93
8.3.30.0110.00318.95
8.3.20.0040.00421.89
8.3.10.0080.00021.76
8.3.00.0000.00819.68
8.2.190.0120.00616.58
8.2.180.0110.00716.88
8.2.170.0090.00622.96
8.2.160.0110.00419.29
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00019.39
8.2.120.0050.00326.35
8.2.110.0070.00320.89
8.2.100.0120.00017.91
8.2.90.0000.00817.97
8.2.80.0050.00318.16
8.2.70.0040.00417.93
8.2.60.0060.00317.92
8.2.50.0080.00018.10
8.2.40.0000.00720.61
8.2.30.0040.00419.30
8.2.20.0040.00418.23
8.2.10.0040.00418.32
8.2.00.0050.00218.12
8.1.280.0120.00625.92
8.1.270.0000.00823.88
8.1.260.0050.00326.35
8.1.250.0060.00328.09
8.1.240.0000.00923.97
8.1.230.0000.01120.91
8.1.220.0080.00017.77
8.1.210.0030.00518.77
8.1.200.0040.00417.35
8.1.190.0050.00317.35
8.1.180.0090.00018.10
8.1.170.0030.00618.77
8.1.160.0000.00718.76
8.1.150.0020.00519.06
8.1.140.0040.00417.60
8.1.130.0000.00719.02
8.1.120.0050.00317.47
8.1.110.0000.00817.61
8.1.100.0000.00717.51
8.1.90.0070.00317.66
8.1.80.0000.00817.66
8.1.70.0050.00217.56
8.1.60.0030.00617.66
8.1.50.0000.00817.71
8.1.40.0000.00917.74
8.1.30.0070.00317.88
8.1.20.0040.00417.66
8.1.10.0050.00317.63
8.1.00.0000.00817.65
8.0.300.0070.00020.15
8.0.290.0070.00017.00
8.0.280.0030.00318.49
8.0.270.0030.00317.21
8.0.260.0080.00017.23
8.0.250.0070.00017.20
8.0.240.0000.00917.05
8.0.230.0000.00916.97
8.0.220.0030.00316.95
8.0.210.0030.00317.00
8.0.200.0060.00317.11
8.0.190.0030.00517.11
8.0.180.0080.00016.98
8.0.170.0040.00417.00
8.0.160.0040.00417.06
8.0.150.0040.00417.01
8.0.140.0000.00717.05
8.0.130.0000.00513.52
8.0.120.0040.00416.98
8.0.110.0040.00417.05
8.0.100.0040.00417.00
8.0.90.0080.00017.02
8.0.80.0070.00716.98
8.0.70.0000.00716.89
8.0.60.0040.00417.13
8.0.50.0000.00717.13
8.0.30.0090.00717.20
8.0.20.0070.01317.40
8.0.10.0030.00516.97
8.0.00.0070.01116.89
7.4.330.0030.00316.76
7.4.320.0030.00316.60
7.4.300.0030.00316.73
7.4.290.0000.00716.75
7.4.280.0060.00316.77
7.4.270.0040.00416.81
7.4.260.0070.00016.86
7.4.250.0020.00516.57
7.4.240.0070.00016.70
7.4.230.0000.00816.62
7.4.220.0040.00416.93
7.4.210.0080.01016.74
7.4.200.0000.00716.88
7.4.160.0070.01116.81
7.4.140.0070.01217.86
7.4.130.0150.00316.80
7.4.120.0080.00916.67
7.4.110.0130.01016.71
7.4.100.0100.00716.72
7.4.90.0060.01216.89
7.4.80.0110.01319.39
7.4.70.0060.01216.81
7.4.60.0070.01016.96
7.4.50.0090.00616.68
7.4.40.0070.01016.71
7.4.00.0100.00615.13
7.3.330.0000.00513.37
7.3.320.0030.00313.46
7.3.310.0070.00016.53
7.3.300.0040.00416.44
7.3.290.0000.00716.43
7.3.280.0110.00516.49
7.3.260.0080.01116.78
7.3.240.0090.00816.63
7.3.230.0100.01016.76
7.3.210.0130.01016.80
7.3.200.0110.00516.61
7.3.190.0070.00716.86
7.3.180.0090.00616.73
7.3.170.0100.00616.92
7.3.160.0040.01216.80
7.3.10.0070.00316.74
7.3.00.0060.00316.70
7.2.330.0110.00716.77
7.2.320.0090.01316.94
7.2.310.0120.00616.93
7.2.300.0040.01516.90
7.2.290.0090.01116.89
7.2.130.0050.00817.28
7.2.120.0080.00416.99
7.2.110.0040.00717.34
7.2.100.0090.00616.90
7.2.90.0070.00717.20
7.2.80.0090.00317.00
7.2.70.0030.00617.12
7.2.60.0090.00617.23
7.2.50.0000.01316.93
7.2.40.2240.01017.59
7.2.30.0130.01117.40
7.2.20.0140.01217.64
7.2.10.2160.00717.56
7.2.00.0190.00817.72
7.1.250.0100.00315.91
7.1.200.0060.00915.82
7.1.160.0630.01116.89
7.1.150.3990.01317.16
7.1.140.0160.01617.00
7.1.130.0130.01517.20
7.1.120.0090.01417.12
7.1.110.0110.01216.13
7.1.100.0160.01116.40
7.1.90.6530.01316.51
7.1.80.4130.01216.34
7.1.70.0150.01015.32
7.1.60.0360.01633.45
7.1.50.0330.01033.14
7.1.40.1500.01432.87
7.1.30.0770.01532.84
7.1.20.0680.01532.88
7.1.10.0300.01415.00
7.1.00.0290.01415.19

preferences:
32.42 ms | 401 KiB | 5 Q