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 */ protected function isWeekend($date) { return date('w', strtotime($date)) % 6 == 0; } } /* End of file day.php */ /* Location: ./life/modules/day/day.php */ $agenda = array( (object)array('priority'=>1) ,(object)array('priority'=>1) ,(object)array('priority'=>1) ,(object)array('priority'=>1) ); $day = new day(); $i = 1; while($i< 10) { echo var_dump($day->doCode($agenda)) . "\n"; $day->date = strtotime($day->date. ' + 1 days'); $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.10.0070.01115.02
7.4.00.0060.01215.13
7.3.130.0100.01015.21
7.3.120.0070.01114.85
7.3.110.0070.01015.17
7.3.100.0070.01015.24
7.3.90.0030.01115.10
7.3.80.0070.00415.04
7.3.70.0020.01115.21
7.3.60.0090.00714.88
7.3.50.0060.00514.90
7.3.40.0080.00815.16
7.3.30.0070.00515.07
7.3.20.0090.00616.92
7.3.10.0050.01016.97
7.3.00.0070.00916.93
7.2.260.0100.00715.49
7.2.250.0110.00815.27
7.2.240.0070.01015.22
7.2.230.0050.01115.20
7.2.220.0080.00515.42
7.2.210.0030.01015.42
7.2.200.0050.00815.36
7.2.190.0050.00715.25
7.2.180.0080.00515.08
7.2.170.0050.00715.21
7.2.160.0100.00715.24
7.2.150.0100.00717.10
7.2.140.0070.00417.19
7.2.130.0090.00917.20
7.2.120.0050.00817.04
7.2.110.0080.00717.23
7.2.100.0050.00817.19
7.2.90.0050.01017.28
7.2.80.0090.00617.08
7.2.70.0090.00617.35
7.2.60.0050.01017.13
7.2.50.0050.00717.16
7.2.40.0090.00617.18
7.2.30.0060.00917.31
7.2.20.0060.01017.14
7.2.10.0060.01017.16
7.2.00.0070.00817.89
7.1.330.0080.00615.99
7.1.320.0050.00915.93
7.1.310.0070.00716.07
7.1.300.0060.00715.95
7.1.290.0050.01015.82
7.1.280.0050.00715.88
7.1.270.0060.00816.08
7.1.260.0000.00916.09
7.1.250.0050.00816.08
7.1.240.0030.01316.14
7.1.230.0030.01316.14
7.1.220.0030.00715.96
7.1.210.0120.00416.12
7.1.200.0060.01315.86
7.1.190.0060.00615.91
7.1.180.0040.01215.82
7.1.170.0120.00315.89
7.1.160.0100.00715.93
7.1.150.0070.00616.03
7.1.140.0030.01316.16
7.1.130.0040.01515.93
7.1.120.0040.00816.18
7.1.110.0030.01216.23
7.1.100.0060.00517.22
7.1.90.0040.00816.06
7.1.80.0040.00415.74
7.1.70.0040.00716.76
7.1.60.0070.01017.60
7.1.50.0050.01016.68
7.1.40.0040.00416.05
7.1.30.0080.00615.69
7.1.20.0080.00616.14
7.1.10.0000.00915.98
7.1.00.0010.03619.13
7.0.330.0000.01815.61
7.0.320.0060.00615.46
7.0.310.0100.00715.72
7.0.300.0030.00915.39
7.0.290.0000.01515.56
7.0.280.0030.01015.61
7.0.270.0000.02015.56
7.0.260.0090.00215.47
7.0.250.0000.01315.45
7.0.240.0060.00315.74
7.0.230.0040.00715.61
7.0.220.0000.00915.63
7.0.210.0000.01415.58
7.0.200.0350.00715.35
7.0.190.0030.00915.36
7.0.180.0090.00615.31
7.0.170.0070.00315.48
7.0.160.0030.00915.41
7.0.150.0030.01015.66
7.0.140.0030.04018.82
7.0.130.0030.01015.79
7.0.120.0000.00915.53
7.0.110.0000.00815.35
7.0.100.0020.03717.80
7.0.90.0080.03017.81
7.0.80.0250.02517.71
7.0.70.0250.04017.86
7.0.60.0080.02417.62
7.0.50.0050.04817.93
7.0.40.0080.03916.77
7.0.30.0140.02616.77
7.0.20.0070.04716.75
7.0.10.0110.04116.98
7.0.00.0060.05016.86
5.6.400.0090.00014.77
5.6.390.0100.00714.65
5.6.380.0000.01114.89
5.6.370.0120.00614.93
5.6.360.0070.01114.16
5.6.350.0060.00914.76
5.6.340.0070.00714.35
5.6.330.0090.00314.38
5.6.320.0140.00014.27
5.6.310.0080.00314.68
5.6.300.0070.00314.53
5.6.290.0080.00414.63
5.6.280.0030.04017.87
5.6.270.0040.00714.81
5.6.260.0040.00814.85
5.6.250.0050.03017.62
5.6.240.0060.04317.49
5.6.230.0070.03617.47
5.6.220.0110.03617.62
5.6.210.0030.04717.59
5.6.200.0070.03017.72
5.6.190.0100.04317.70
5.6.180.0060.03317.91
5.6.170.0070.04717.71
5.6.160.0090.03217.86
5.6.150.0050.04617.72
5.6.140.0100.03817.70
5.6.130.0110.04317.83
5.6.120.0030.03217.76
5.6.110.0030.02817.94
5.6.100.0070.04617.97
5.6.90.0110.03817.81
5.6.80.0030.03717.46
5.6.70.0090.04317.50
5.6.60.0050.02317.42
5.6.50.0070.03717.25
5.6.40.0100.04017.51
5.6.30.0090.04017.54
5.6.20.0050.03717.42
5.6.10.0050.03817.47
5.6.00.0090.02217.35
5.5.380.0080.04517.49
5.5.370.0040.04417.46
5.5.360.0070.03717.37
5.5.350.0070.04517.39
5.5.340.0070.03617.51
5.5.330.0050.04517.53
5.5.320.0050.04117.54
5.5.310.0020.05017.67
5.5.300.0080.04017.54
5.5.290.0050.04417.74
5.5.280.0020.04517.71
5.5.270.0070.05017.57
5.5.260.0040.04417.67
5.5.250.0050.03517.51
5.5.240.0090.02017.33
5.5.230.0040.04717.36
5.5.220.0070.04017.28
5.5.210.0020.03217.27
5.5.200.0100.03417.26
5.5.190.0000.04517.30
5.5.180.0180.03217.28
5.5.170.0070.00714.38
5.5.160.0070.03317.19
5.5.150.0070.03217.34
5.5.140.0050.04517.39
5.5.130.0050.02617.17
5.5.120.0120.03017.39
5.5.110.0040.04617.30
5.5.100.0050.02717.30
5.5.90.0050.03317.22
5.5.80.0050.05217.27
5.5.70.0030.02917.39
5.5.60.0100.04817.38
5.5.50.0030.03817.36
5.5.40.0050.03217.13
5.5.30.0030.04717.37
5.5.20.0050.04117.41
5.5.10.0080.03817.26
5.5.00.0050.04716.90
5.4.450.0030.04515.72
5.4.440.0050.03315.79
5.4.430.0080.03715.88
5.4.420.0080.02715.70
5.4.410.0040.02915.66
5.4.400.0040.04115.71
5.4.390.0030.04115.68
5.4.380.0030.04415.63
5.4.370.0030.03915.63
5.4.360.0030.04315.67
5.4.350.0030.04315.63
5.4.340.0070.02715.67
5.4.330.0000.00712.22
5.4.320.0050.03815.66
5.4.310.0040.02515.58
5.4.300.0060.03615.63
5.4.290.0060.03615.71
5.4.280.0060.02515.62
5.4.270.0040.04015.68
5.4.260.0030.04015.72
5.4.250.0040.04115.63
5.4.240.0050.02515.65
5.4.230.0050.03915.63
5.4.220.0060.04115.68
5.4.210.0030.03815.56
5.4.200.0030.03415.63
5.4.190.0080.03315.72
5.4.180.0000.04215.70
5.4.170.0050.04215.51
5.4.160.0080.03715.72
5.4.150.0100.02215.71
5.4.140.0030.02314.34
5.4.130.0070.04114.28
5.4.120.0140.03314.32
5.4.110.0050.04014.39
5.4.100.0100.02114.36
5.4.90.0030.03414.27
5.4.80.0030.02314.36
5.4.70.0030.02414.38
5.4.60.0030.02414.33
5.4.50.0070.03614.27
5.4.40.0040.02214.30
5.4.30.0040.02114.33
5.4.20.0050.03514.26
5.4.10.0070.03714.36
5.4.00.0060.02614.04
5.3.290.0030.02913.47
5.3.280.0070.03813.45
5.3.270.0020.03813.43
5.3.260.0050.02713.40
5.3.250.0070.02713.42
5.3.240.0070.03713.39
5.3.230.0070.04213.42
5.3.220.0020.04413.38
5.3.210.0020.02513.43
5.3.200.0030.03213.45
5.3.190.0080.03013.43
5.3.180.0050.02213.41
5.3.170.0070.02813.38
5.3.160.0030.03813.43
5.3.150.0080.02013.47
5.3.140.0070.03713.38
5.3.130.0070.04213.39
5.3.120.0040.02513.36
5.3.110.0020.03013.45
5.3.100.0030.03813.13
5.3.90.0050.03813.09
5.3.80.0080.03813.12
5.3.70.0070.03213.18
5.3.60.0020.02513.18
5.3.50.0110.01813.09
5.3.40.0020.03913.12
5.3.30.0050.04213.06
5.3.20.0060.02013.00
5.3.10.0070.03212.99
5.3.00.0080.02812.90
5.2.170.0100.06011.04
5.2.160.0070.05011.08
5.2.150.0100.02311.07
5.2.140.0030.06011.05
5.2.130.0200.06310.97
5.2.120.0030.05711.03
5.2.110.0030.03011.10
5.2.100.0030.03311.17
5.2.90.0000.04310.98
5.2.80.0000.07011.11
5.2.70.0100.06711.06
5.2.60.0070.05711.13
5.2.50.0100.05711.14
5.2.40.0070.06011.13
5.2.30.0100.05011.04
5.2.20.0100.03710.92
5.2.10.0070.06010.88
5.2.00.0030.05710.76
5.1.60.0030.03310.06
5.1.50.0030.05710.13
5.1.40.0070.03710.05
5.1.30.0070.04710.37
5.1.20.0100.05710.50
5.1.10.0030.0479.92
5.1.00.0130.04710.18
5.0.50.0070.0438.56
5.0.40.0030.0438.48
5.0.30.0000.0708.25
5.0.20.0000.0338.30
5.0.10.0030.0338.25
5.0.00.0070.0608.07
4.4.90.0000.0276.87
4.4.80.0000.0306.87
4.4.70.0000.0206.87
4.4.60.0000.0306.87
4.4.50.0000.0176.87
4.4.40.0070.0536.87
4.4.30.0030.0336.87
4.4.20.0030.0336.87
4.4.10.0030.0276.87
4.4.00.0000.0476.87
4.3.110.0100.0206.87
4.3.100.0000.0236.87
4.3.90.0000.0336.87
4.3.80.0100.0376.87
4.3.70.0030.0336.87
4.3.60.0030.0306.87
4.3.50.0030.0236.87
4.3.40.0000.0276.87
4.3.30.0000.0376.87
4.3.20.0030.0336.87
4.3.10.0000.0406.87
4.3.00.0000.0176.87

preferences:
28.37 ms | 401 KiB | 5 Q