3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Person { function __construct($c) { $this->count = $c; } function getPrev() { return $this->prev; } function setPrev($pr) { $this->prev = $pr; } function getNext() { return $this->next; } function setNext($nxt) { $this->next = $nxt; } function shout($shout, $nth) { if ($shout < $nth) { return $shout + 1; } $this->getPrev()->setNext($this->getNext()); $this->getNext()->setPrev($this->getPrev()); return 1; } } class Chain { public $first; function __construct($size) { $last =null; for($i = 0; $i < $size ; $i++) { $current = new Person($i); if ($this->first == null) $this->first = $current; if ($last != null) { $last->setNext($current); $current->setPrev($last); } $last = $current; } $this->first->setPrev($last); $last->setNext($this->first); } function kill($nth) { $current = $this->first; $shout = 1; while($current->getNext() !== $current) { $shout = $current->shout($shout,$nth); $current = $current->getNext(); } $this->first = $current; } } $start = microtime(true); $ITER = 1000; for($i = 0 ; $i < $ITER ; $i++) { $chain = new Chain(40); $chain->kill(3); } $end = microtime(true); printf("Time per iteration = %3.2f microsecondsnr",(($end - $start) * 1000 / $ITER));

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.3.10.0000.06116.63
7.3.00.0060.05116.62
7.2.130.0000.05917.11
7.2.120.0000.06917.02
7.2.110.0160.05616.96
7.2.100.0100.06016.91
7.2.90.0100.05217.02
7.2.80.0000.07217.02
7.2.70.0090.06017.05
7.2.60.0070.06316.84
7.2.50.0070.06017.06
7.2.40.0070.05516.92
7.2.30.0100.05817.04
7.2.20.0070.05617.09
7.2.10.0070.06116.82
7.2.00.0000.05918.28
7.1.250.0100.08815.93
7.1.70.0000.03916.96
7.1.60.0070.08519.40
7.1.50.0100.07616.88
7.1.00.0100.13022.57
7.0.200.0810.04115.39
7.0.140.0100.12721.96
7.0.110.0200.10020.44
7.0.100.0300.08320.54
7.0.90.0030.07720.48
7.0.80.0030.10720.45
7.0.70.0130.07020.45
7.0.60.0070.06320.34
7.0.50.0130.06320.33
7.0.40.0070.06319.76
7.0.30.0100.06319.88
7.0.20.0000.07019.85
7.0.10.0000.06319.78
7.0.00.0170.06319.82
5.6.280.0030.19021.73
5.6.260.0030.12321.37
5.6.250.0030.14021.33
5.6.240.0070.11021.26
5.6.230.0030.10721.10
5.6.220.0070.12021.24
5.6.210.0000.10721.29
5.6.200.0030.10321.28
5.6.190.0070.10021.09
5.6.180.0070.10321.49
5.6.170.0230.11021.27
5.6.160.0000.11721.30
5.6.150.0000.14321.32
5.6.140.0000.12021.09
5.6.130.0070.11721.22
5.6.120.0030.10321.28
5.6.110.0070.10021.26
5.6.100.0030.11321.31
5.6.90.0230.11021.15
5.6.80.0070.13320.64
5.6.70.0000.13720.61
5.6.60.0070.09720.57
5.6.50.0030.10720.54
5.6.40.0000.10320.62
5.6.30.0000.10320.55
5.6.20.0030.12020.68
5.6.10.0030.11020.59
5.6.00.0030.10720.61
5.5.380.0170.12318.21
5.5.370.0030.13018.09
5.5.360.0070.11018.17
5.5.350.0000.11018.16
5.5.340.0030.11018.64
5.5.330.0270.11018.61
5.5.320.0100.11318.74
5.5.310.0070.10718.71
5.5.300.0000.11018.73
5.5.290.0030.12018.51
5.5.280.0030.11018.76
5.5.270.0000.12018.51
5.5.260.0030.11318.52
5.5.250.0070.12718.57
5.5.240.0000.11318.09
5.5.230.0070.12017.91
5.5.220.0000.17318.08
5.5.210.0100.10018.11
5.5.200.0030.11718.00
5.5.190.0000.11318.02
5.5.180.0030.11017.99
5.5.160.0030.10317.99
5.5.150.0000.12018.08
5.5.140.0030.11718.05
5.5.130.0030.17018.05
5.5.120.0070.14018.10
5.5.110.0070.10318.01
5.5.100.0000.13317.92
5.5.90.0070.12317.78
5.5.80.0030.12717.89
5.5.70.0000.11317.83
5.5.60.0030.13317.95
5.5.50.0030.12017.78
5.5.40.0070.10317.88
5.5.30.0000.11318.00
5.5.20.0030.13017.97
5.5.10.0030.10717.85
5.5.00.0000.12017.87
5.4.450.0030.10719.92
5.4.440.0030.10719.89
5.4.430.0030.15019.88
5.4.420.0100.09719.96
5.4.410.0000.14019.70
5.4.400.0070.10719.74
5.4.390.0000.12319.60
5.4.380.0000.11019.65
5.4.370.0030.10319.56
5.4.360.0230.14319.91
5.4.350.0100.11019.79
5.4.340.0000.12019.59
5.4.320.0030.10319.52
5.4.310.0100.10019.61
5.4.300.0100.15019.47
5.4.290.0030.11019.63
5.4.280.0000.15019.75
5.4.270.0130.16019.48
5.4.260.0000.13319.66
5.4.250.0070.10019.59
5.4.240.0000.11319.53
5.4.230.0030.10719.53
5.4.220.0100.15019.56
5.4.210.0030.11019.60
5.4.200.0030.14319.60
5.4.190.0000.15719.74
5.4.180.0030.11319.72
5.4.170.0000.10719.56
5.4.160.0000.11319.50
5.4.150.0170.12019.58
5.4.140.0030.10316.93
5.4.130.0000.17016.96
5.4.120.0100.14317.01
5.4.110.0000.12716.96
5.4.100.0200.11017.02
5.4.90.0030.14317.07
5.4.80.0030.17017.06
5.4.70.0070.10317.09
5.4.60.0000.13317.08
5.4.50.0000.12317.10
5.4.40.0030.12317.08
5.4.30.0100.12017.02
5.4.20.0070.12717.14
5.4.10.0100.09716.88
5.4.00.0000.13316.33
5.3.290.0030.18315.54
5.3.280.0030.13315.35
5.3.270.0070.16015.34
5.3.260.0000.14715.35
5.3.250.0000.14015.36
5.3.240.0330.14315.41
5.3.230.0030.14015.41
5.3.220.0070.15715.33
5.3.210.0000.15315.39
5.3.200.0000.18715.30
5.3.190.0000.14015.26
5.3.180.0070.20315.15
5.3.170.0030.18315.43
5.3.160.0070.13315.31
5.3.150.0030.14315.38
5.3.140.0000.14015.32
5.3.130.0070.17015.42
5.3.120.0070.14015.41
5.3.110.0030.13715.28
5.3.100.0030.13714.77
5.3.90.0030.14314.88
5.3.80.0130.13314.74
5.3.70.0100.14014.72
5.3.60.0030.17314.74
5.3.50.0000.16714.76
5.3.40.0030.17714.64
5.3.30.0030.17014.59
5.3.20.0070.13014.39
5.3.10.0030.16014.41
5.3.00.0030.13714.32
5.2.170.0100.16711.81
5.2.160.0000.17011.81
5.2.150.0000.14311.81
5.2.140.0000.15711.81
5.2.130.0070.15011.81
5.2.120.0070.17011.81
5.2.110.0000.14311.81
5.2.100.0000.14711.81
5.2.90.0030.16311.81
5.2.80.0000.18711.81
5.2.70.0030.18711.81
5.2.60.0030.17711.81
5.2.50.0000.17311.81
5.2.40.0030.20311.82
5.2.30.0030.14011.81
5.2.20.0030.14011.81
5.2.10.0070.16011.81
5.2.00.0000.17011.81
5.1.60.0070.17011.81
5.1.50.0030.17011.81
5.1.40.0030.13711.81
5.1.30.0000.13711.81
5.1.20.0000.15711.81
5.1.10.0070.13711.81
5.1.00.0030.13711.81
5.0.50.0100.25711.81
5.0.40.0000.27711.81
5.0.30.0000.24011.81
5.0.20.0000.21311.81
5.0.10.0030.21711.81
5.0.00.0100.22711.81
4.4.90.0030.01311.81
4.4.80.0000.01311.81
4.4.70.0030.01711.81
4.4.60.0030.01011.81
4.4.50.0000.01311.81
4.4.40.0000.02311.81
4.4.30.0000.01711.81
4.4.20.0000.01311.81
4.4.10.0000.01311.81
4.4.00.0030.02011.81
4.3.110.0000.01711.81
4.3.100.0000.01311.81
4.3.90.0030.01011.81
4.3.80.0000.02311.81
4.3.70.0030.01011.81
4.3.60.0070.01011.81
4.3.50.0000.01311.81
4.3.40.0030.02011.81
4.3.30.0000.01311.81
4.3.20.0000.01311.81
4.3.10.0030.01011.81
4.3.00.0000.01311.81

preferences:
36.19 ms | 401 KiB | 5 Q