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 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.60.0080.00818.27
8.3.50.0160.00018.30
8.3.40.0150.00019.09
8.3.30.0120.00318.88
8.3.20.0040.00421.76
8.3.10.0060.00321.89
8.3.00.0050.00319.80
8.2.180.0150.00317.00
8.2.170.0040.01222.96
8.2.160.0060.00921.19
8.2.150.0050.00324.18
8.2.140.0030.00624.66
8.2.130.0040.00419.27
8.2.120.0040.00426.35
8.2.110.0030.00621.12
8.2.100.0120.00017.91
8.2.90.0060.00317.89
8.2.80.0040.00418.16
8.2.70.0050.00318.05
8.2.60.0060.00317.80
8.2.50.0030.00518.34
8.2.40.0080.00020.64
8.2.30.0000.00719.25
8.2.20.0000.00718.24
8.2.10.0040.00418.18
8.2.00.0060.00318.29
8.1.280.0150.00725.92
8.1.270.0040.00423.83
8.1.260.0100.00326.35
8.1.250.0040.00428.09
8.1.240.0080.00323.98
8.1.230.0060.00620.91
8.1.220.0080.00017.74
8.1.210.0000.00818.83
8.1.200.0000.01017.47
8.1.190.0000.01217.23
8.1.180.0030.00518.10
8.1.170.0040.00418.66
8.1.160.0040.00418.90
8.1.150.0000.00719.12
8.1.140.0070.00017.73
8.1.130.0000.00719.08
8.1.120.0030.00517.61
8.1.110.0040.00417.56
8.1.100.0000.00717.62
8.1.90.0030.00617.64
8.1.80.0040.00417.55
8.1.70.0070.00017.63
8.1.60.0030.00617.67
8.1.50.0000.00817.59
8.1.40.0050.00317.72
8.1.30.0060.00317.80
8.1.20.0040.00417.84
8.1.10.0030.00517.62
8.1.00.0040.00417.65
8.0.300.0080.00020.11
8.0.290.0050.00316.88
8.0.280.0050.00218.40
8.0.270.0030.00317.30
8.0.260.0060.00017.29
8.0.250.0050.00317.10
8.0.240.0000.00917.14
8.0.230.0000.00816.82
8.0.220.0050.00217.04
8.0.210.0040.00417.05
8.0.200.0100.00017.16
8.0.190.0000.00717.16
8.0.180.0040.00416.99
8.0.170.0030.00617.08
8.0.160.0000.00717.03
8.0.150.0030.00517.06
8.0.140.0000.00717.07
8.0.130.0060.00013.43
8.0.120.0050.00317.02
8.0.110.0040.00417.07
8.0.100.0000.00816.91
8.0.90.0070.00016.98
8.0.80.0090.01217.11
8.0.70.0000.00817.11
8.0.60.0040.00417.12
8.0.50.0000.00816.98
8.0.30.0090.00917.18
8.0.20.0120.01117.40
8.0.10.0030.00517.05
8.0.00.0060.01216.73
7.4.330.0000.00516.80
7.4.320.0000.01016.71
7.4.300.0000.00716.73
7.4.290.0000.00816.84
7.4.280.0000.00816.66
7.4.270.0080.00016.76
7.4.260.0000.00716.62
7.4.250.0040.00416.66
7.4.240.0040.00416.88
7.4.230.0070.00016.79
7.4.220.0040.00416.91
7.4.210.0130.00816.82
7.4.200.0030.00316.92
7.4.160.0100.00716.72
7.4.140.0140.00417.86
7.4.130.0150.00616.89
7.4.120.0140.00516.76
7.4.110.0130.00416.85
7.4.100.0100.00716.60
7.4.90.0090.00916.79
7.4.80.0110.01119.39
7.4.70.0070.01016.93
7.4.60.0100.00716.58
7.4.50.0030.01316.67
7.4.40.0060.01116.80
7.4.00.0060.01015.30
7.3.330.0000.00513.52
7.3.320.0000.00613.36
7.3.310.0000.00716.58
7.3.300.0030.00316.41
7.3.290.0070.00016.55
7.3.280.0080.01116.52
7.3.260.0140.01216.70
7.3.240.0100.00916.59
7.3.230.0070.01416.53
7.3.210.0070.01016.86
7.3.200.0120.00616.89
7.3.190.0120.00616.97
7.3.180.0050.01116.82
7.3.170.0080.00816.81
7.3.160.0100.00716.56
7.2.330.0070.01117.09
7.2.320.0110.00816.73
7.2.310.0120.00616.90
7.2.300.0090.00916.82
7.2.290.0090.00916.93
7.2.60.0200.00416.78
7.2.40.0150.01118.38
7.2.30.0140.01018.05
7.2.20.0160.00718.27
7.2.10.1410.00817.88
7.2.00.0090.01818.20
7.1.200.0090.00615.89
7.1.160.0130.01017.02
7.1.150.1100.01217.13
7.1.140.0120.01217.25
7.1.130.1760.01217.21
7.1.120.0160.00817.18
7.1.110.0180.01616.57
7.1.100.0150.01116.59
7.1.90.1600.01516.60
7.1.80.0100.01916.32
7.1.70.1570.01215.73
7.1.60.1220.02033.70
7.1.50.0370.02033.31
7.1.40.1830.02132.95
7.1.30.0380.01932.91
7.1.20.0310.02533.05
7.1.10.0130.01514.97
7.1.00.1610.01315.05

preferences:
62.07 ms | 400 KiB | 5 Q