3v4l.org

run code in 300+ PHP versions simultaneously
<?php class day{ public $date; public function __construct() { $this->date = time(); } /** * Should I write code today? * @param (array) $todos Current list of TODOs * @return boolean I should code if true. */ public function doCode($todos) { //return true; //Never stop coding $chore = next($todos); while($chore && $chore->priority < 3 ) $chore = next($todos); return $chore === false || $this->isWeekend($this->date); } /** * Is the date in teh weekend? * @param string $date String date to check * @return boolean True if date is in the weekend */ public function isWeekend($date) { return date('w', $date) % 6 == 0; } } /* End of file day.php */ /* Location: ./life/modules/day/day.php */ $agenda = array( (object)array('priority'=>1) ,(object)array('priority'=>4) ,(object)array('priority'=>1) ,(object)array('priority'=>5) ); $day = new day(); $i = 1; while($i< 10) { echo var_dump($day->doCode($agenda)) . "\n"; $day->date = strtotime('+1 day', $day->date); $i++; }

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)
7.4.00.0100.00715.02
7.3.120.0060.01015.24
7.3.110.0030.01015.33
7.3.100.0000.01214.84
7.3.90.0000.01114.94
7.3.80.0000.01114.99
7.3.70.0060.00615.17
7.3.60.0000.01115.23
7.3.50.0000.01114.96
7.3.40.0000.01115.14
7.3.30.0040.00714.86
7.3.20.0000.01116.96
7.3.10.0000.01116.65
7.3.00.0000.01116.83
7.2.250.0000.01115.18
7.2.240.0000.01315.56
7.2.230.0040.00915.05
7.2.220.0090.00315.42
7.2.210.0040.00815.22
7.2.200.0000.01215.36
7.2.190.0000.01215.41
7.2.180.0040.00815.08
7.2.170.0080.00415.05
7.2.60.0050.00317.31
7.2.50.0070.00716.98
7.1.330.0000.01316.04
7.1.320.0040.00716.02
7.1.310.0040.00716.00
7.1.300.0030.00815.96
7.1.290.0040.00716.13
7.1.280.0070.00416.03
7.1.270.0040.00716.06
7.1.260.0070.00415.77
7.1.200.0150.00615.57
7.1.70.0190.00317.27
7.1.60.0060.01617.21
7.1.50.0090.00917.26
7.1.00.0000.07722.32
7.0.200.0030.01017.07
7.0.140.0030.07322.18
7.0.80.0530.07719.91
7.0.70.0530.04019.99
7.0.60.0670.07019.93
7.0.50.0600.06720.22
7.0.40.0100.04720.14
7.0.30.0100.08020.05
7.0.20.0170.07720.14
7.0.10.0130.07020.08
7.0.00.0030.04320.18
5.6.280.0100.07021.00
5.6.230.0030.09020.67
5.6.220.0130.07720.59
5.6.210.0030.05720.57
5.6.200.0100.09021.04
5.6.190.0070.07320.95
5.6.180.0200.07021.04
5.6.170.0100.08020.98
5.6.160.0070.04721.12
5.6.150.0030.07721.07
5.6.140.0030.07321.11
5.6.130.0100.05321.14
5.6.120.0070.07320.95
5.6.110.0070.07321.13
5.6.100.0030.05021.03
5.6.90.0100.07721.09
5.6.80.0030.08720.50
5.6.70.0100.07720.50
5.6.60.0130.07720.38
5.6.50.0170.06720.43
5.6.40.0100.04320.54
5.6.30.0070.08320.45
5.6.20.0100.08020.44
5.6.10.0130.06020.32
5.6.00.0100.07320.44
5.5.370.0200.07020.58
5.5.360.0100.07720.37
5.5.350.0100.08320.44
5.5.340.0100.06320.88
5.5.330.0070.04020.65
5.5.320.0030.07020.87
5.5.310.0070.08320.77
5.5.300.0100.05320.93
5.5.290.0100.08020.89
5.5.280.0100.07020.83
5.5.270.0070.05720.77
5.5.260.0100.07720.89
5.5.250.0130.04720.75
5.5.240.0170.06720.30
5.5.230.0030.08720.12
5.5.220.0170.07320.29
5.5.210.0130.08020.30
5.5.200.0130.04320.10
5.5.190.0070.08319.98
5.5.180.0130.07020.09
5.5.160.0000.05020.13
5.5.150.0000.05720.23
5.5.140.0170.06720.25
5.5.130.0070.07720.27
5.5.120.0130.07320.23
5.5.110.0000.05020.25
5.5.100.0070.06020.02
5.5.90.0070.03719.99
5.5.80.0130.03319.98
5.5.70.0100.03320.05
5.5.60.0030.03720.07
5.5.50.0030.04020.07
5.5.40.0100.03720.03
5.5.30.0030.04020.05
5.5.20.0030.03720.13
5.5.10.0000.05320.09
5.5.00.0070.07020.08
5.4.450.0100.07719.37
5.4.440.0030.08719.36
5.4.430.0100.07719.46
5.4.420.0130.06719.36
5.4.410.0170.07019.07
5.4.400.0070.07019.21
5.4.390.0100.07719.16
5.4.380.0170.06019.03
5.4.370.0030.07719.13
5.4.360.0030.07019.13
5.4.350.0200.07019.18
5.4.340.0130.07019.09
5.4.320.0130.07319.16
5.4.310.0100.07319.13
5.4.300.0170.06718.94
5.4.290.0030.08319.02
5.4.280.0100.07018.88
5.4.270.0100.07319.17
5.4.260.0100.05319.04
5.4.250.0030.05319.23
5.4.240.0030.04019.04
5.4.230.0000.04019.04
5.4.220.0000.05719.04
5.4.210.0030.03319.03
5.4.200.0030.07719.04
5.4.190.0070.03019.03
5.4.180.0030.03719.13
5.4.170.0030.08019.07
5.4.160.0070.04019.11
5.4.150.0030.03718.89
5.4.140.0000.07316.52
5.4.130.0030.08016.38
5.4.120.0030.03716.50
5.4.110.0070.03316.32
5.4.100.0070.03316.57
5.4.90.0070.05016.39
5.4.80.0070.03316.54
5.4.70.0000.07316.43
5.4.60.0100.03316.48
5.4.50.0030.03716.34
5.4.40.0000.04016.36
5.4.30.0000.04016.48
5.4.20.0000.03716.43
5.4.10.0070.03316.30
5.4.00.0030.04015.94
5.3.290.0070.04715.93
5.3.280.0000.04315.93
5.3.270.0000.04015.93
5.3.260.0070.05715.93
5.3.250.0030.03315.93
5.3.240.0030.04315.93
5.3.230.0070.07315.93
5.3.220.0030.04015.93
5.3.210.0000.07715.93
5.3.200.0070.06315.93
5.3.190.0070.04315.93
5.3.180.0000.04015.93
5.3.170.0070.03315.93
5.3.160.0030.06715.93
5.3.150.0070.04715.93
5.3.140.0070.03315.93
5.3.130.0070.03315.93
5.3.120.0000.04015.93
5.3.110.0070.03315.93
5.3.100.0000.03315.93
5.3.90.0070.04715.93
5.3.80.0000.03315.93
5.3.70.0070.04315.93
5.3.60.0030.03315.93
5.3.50.0000.03715.93
5.3.40.0070.03715.93
5.3.30.0030.03715.93
5.3.20.0030.03315.93
5.3.10.0070.05715.93
5.3.00.0000.03715.93
5.2.170.0070.02315.93
5.2.160.0000.04015.93
5.2.150.0030.03015.93
5.2.140.0000.02715.93
5.2.130.0030.02715.93
5.2.120.0070.02715.93
5.2.110.0070.02315.93
5.2.100.0100.03015.93
5.2.90.0000.04015.93
5.2.80.0000.03015.93
5.2.70.0000.03015.93
5.2.60.0030.03015.93
5.2.50.0000.03015.93
5.2.40.0000.06315.93
5.2.30.0000.03015.93
5.2.20.0000.03015.93
5.2.10.0000.03315.93
5.2.00.0000.03015.93
5.1.60.0100.01715.93
5.1.50.0000.02715.93
5.1.40.0000.02015.93
5.1.30.0000.02715.93
5.1.20.0030.02315.93
5.1.10.0030.06015.93
5.1.00.0070.03015.93
5.0.50.0070.04315.93
5.0.40.0130.01715.93
5.0.30.0030.05315.93
5.0.20.0030.04315.93
5.0.10.0070.03315.93
5.0.00.0030.03015.93
4.4.90.0000.03315.93
4.4.80.0000.01715.93
4.4.70.0000.02715.93
4.4.60.0000.02315.93
4.4.50.0070.01315.93
4.4.40.0030.03015.93
4.4.30.0030.01315.93
4.4.20.0030.01715.93
4.4.10.0030.03715.93
4.4.00.0000.04715.93
4.3.110.0000.04015.93
4.3.100.0000.01715.93
4.3.90.0000.02715.93
4.3.80.0000.04015.93
4.3.70.0000.02315.93
4.3.60.0000.03315.93
4.3.50.0000.02315.93
4.3.40.0000.05315.93
4.3.30.0000.03315.93
4.3.20.0100.02715.93
4.3.10.0030.02315.93
4.3.00.0000.02015.93

preferences:
40.57 ms | 400 KiB | 5 Q