3v4l.org

run code in 300+ PHP versions simultaneously
<?php function s_datediff( $str_interval, $dt_menor, $dt_maior, $relative=false){ if( is_string( $dt_menor)) $dt_menor = date_create( $dt_menor); if( is_string( $dt_maior)) $dt_maior = date_create( $dt_maior); $diff = date_diff( $dt_menor, $dt_maior, ! $relative); switch( $str_interval){ case "y": $total = $diff->y + $diff->m / 12 + $diff->d / 365.25; break; case "m": $total= $diff->y * 12 + $diff->m + $diff->d/30 + $diff->h / 24; break; case "d": $total = $diff->y * 365.25 + $diff->m * 30 + $diff->d + $diff->h/24 + $diff->i / 60; break; case "h": $total = ($diff->y * 365.25 + $diff->m * 30 + $diff->d) * 24 + $diff->h + $diff->i/60; break; case "i": $total = (($diff->y * 365.25 + $diff->m * 30 + $diff->d) * 24 + $diff->h) * 60 + $diff->i + $diff->s/60; break; case "s": $total = ((($diff->y * 365.25 + $diff->m * 30 + $diff->d) * 24 + $diff->h) * 60 + $diff->i)*60 + $diff->s; break; } if( $diff->invert) return -1 * $total; else return $total; } $begin = mktime(9, 15, 0, date("m") , date("d"), date("Y")); $end = mktime(14, 0, 0, date("m") , date("d"), date("Y")); echo "begin is $begin and end is $end<br>"; $begin_time = date("H:i:s", $begin); $end_time = date("H:i:s", $end); echo "begin_time is $begin_time and end_time is $end_time<br>"; $diff = new DateTime($end_time) -> diff(new DateTime($begin_time)); echo "diff is $diff";

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)
5.4.340.0070.03512.04
5.4.320.0040.04212.54
5.4.310.0090.04312.53
5.4.300.0110.04212.54
5.4.290.0070.03712.54
5.4.280.0110.03812.43
5.4.270.0080.04112.43
5.4.260.0070.04012.43
5.4.250.0070.03812.43
5.4.240.0140.04812.43
5.4.230.0070.04112.42
5.4.220.0040.04012.43
5.4.210.0070.03712.42
5.4.200.0090.03812.42
5.4.190.0040.04112.42
5.4.180.0050.03812.42
5.4.170.0070.04712.42
5.4.160.0110.03912.42
5.4.150.0040.03812.41
5.4.140.0130.03312.11
5.4.130.0060.03812.08
5.4.120.0070.03612.05
5.4.110.0080.03612.05
5.4.100.0070.03412.05
5.4.90.0100.04712.05
5.4.80.0090.03912.04
5.4.70.0070.03512.04
5.4.60.0050.03812.04
5.4.50.0070.03512.04
5.4.40.0080.03712.03
5.4.30.0060.03712.03
5.4.20.0080.03912.02
5.4.10.0050.03612.03
5.4.00.0110.03211.52
5.3.290.0080.03812.80
5.3.280.0110.03312.71
5.3.270.0040.04112.73
5.3.260.0060.04912.72
5.3.250.0060.03712.71
5.3.240.0080.03812.72
5.3.230.0040.04212.71
5.3.220.0050.03912.68
5.3.210.0050.04012.68
5.3.200.0050.03712.68
5.3.190.0050.03812.68
5.3.180.0060.03712.67
5.3.170.0070.03812.67
5.3.160.0070.03712.67
5.3.150.0050.03912.67
5.3.140.0100.03912.66
5.3.130.0090.04012.66
5.3.120.0040.04012.65
5.3.110.0060.04112.66
5.3.100.0040.04012.14
5.3.90.0090.03712.13
5.3.80.0110.03812.12
5.3.70.0050.04012.12
5.3.60.0060.03912.10
5.3.50.0040.03712.05
5.3.40.0040.04012.05
5.3.30.0050.03712.00
5.3.20.0090.04211.79
5.3.10.0070.03411.75
5.3.00.0040.03811.74
5.2.170.0080.0349.25
5.2.160.0080.0319.25
5.2.150.0040.0319.25
5.2.140.0060.0319.25
5.2.130.0030.0429.20
5.2.120.0030.0419.20
5.2.110.0040.0349.21
5.2.100.0090.0309.20
5.2.90.0010.0339.20
5.2.80.0060.0299.20
5.2.70.0040.0309.20
5.2.60.0070.0299.16
5.2.50.0050.0319.12
5.2.40.0050.0329.10
5.2.30.0030.0339.07
5.2.20.0020.0319.08
5.2.10.0070.0258.98
5.2.00.0040.0298.85
5.1.60.0040.0268.13
5.1.50.0060.0238.12
5.1.40.0050.0258.11
5.1.30.0060.0278.46
5.1.20.0060.0278.48
5.1.10.0040.0288.21
5.1.00.0100.0318.21
5.0.50.0090.0236.68
5.0.40.0080.0286.54
5.0.30.0080.0426.35
5.0.20.0060.0256.34
5.0.10.0060.0316.33
5.0.00.0000.0396.32
4.4.90.0040.0184.78
4.4.80.0050.0154.75
4.4.70.0040.0194.75
4.4.60.0050.0184.75
4.4.50.0040.0294.77
4.4.40.0080.0434.71
4.4.30.0050.0154.76
4.4.20.0060.0174.84
4.4.10.0030.0224.85
4.4.00.0040.0324.76
4.3.110.0050.0164.67
4.3.100.0030.0184.67
4.3.90.0050.0154.63
4.3.80.0040.0284.61
4.3.70.0030.0154.63
4.3.60.0040.0144.63
4.3.50.0040.0144.63
4.3.40.0040.0234.56
4.3.30.0030.0193.37
4.3.20.0010.0173.34
4.3.10.0040.0153.30
4.3.00.0230.0207.19

preferences:
139.97 ms | 1446 KiB | 7 Q