3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** Object responsible for echoing debug data **/ class EchoLogger implements \SplObserver { public function update(\SplSubject $subject) { printf("Rand: %s, Status: %s", $subject->getRand(), $subject->getStatus()); } } /** Object responsible for emailing debug data **/ class EmailLogger implements \SplObserver { public function update(\SplSubject $subject) { /** Mail your data **/ } } class HttpClientService implements \SplSubject { private $observers = array(); public function getRand() { return $this->rand; } public function getStatus() { return $this->status; } public function attach(\SplObserver $observer) { $this->observers[] = $observer; } public function detach(\SplObserver $observer) { if($key = array_search($observer,$this->observers, true)) { unset($this->observers[$key]); } } public function notify() { foreach ($this->observers as $observer) { $observer->update($this); } } public function getServiceStatus() { // -- SNIP -- $this->rand = rand(0, 10); $this->status = ($this->rand >= 5) ? 'success' : 'error'; // -- Snip -- return $this->status; } } $service = new HttpClientService; $service->attach(new EchoLogger);

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.0090.00515.08
7.3.120.0060.01014.99
7.3.110.0050.01314.81
7.3.100.0090.00814.84
7.3.90.0050.00814.65
7.3.80.0040.01014.75
7.3.70.0080.00414.80
7.3.60.0080.00714.73
7.3.50.0060.00814.69
7.3.40.0060.00814.61
7.3.30.0090.00514.75
7.3.20.0100.00516.54
7.3.10.0050.00716.51
7.3.00.0030.01116.58
7.2.250.0090.01014.90
7.2.240.0070.01015.01
7.2.230.0100.00514.90
7.2.220.0080.00815.07
7.2.210.0050.01115.15
7.2.200.0080.00714.89
7.2.190.0080.00514.97
7.2.180.0050.00715.03
7.2.170.0070.00814.97
7.2.160.0000.01714.82
7.2.150.0040.00816.77
7.2.140.0090.00616.86
7.2.130.0020.00916.86
7.2.120.0080.00816.93
7.2.110.0050.00617.03
7.2.100.0050.00816.85
7.2.90.0060.00816.98
7.2.80.0050.00816.94
7.2.70.0070.00817.03
7.2.60.0020.01316.82
7.2.50.0050.00816.92
7.2.40.0060.00816.85
7.2.30.0050.00916.87
7.2.20.0080.00816.75
7.2.10.0090.00616.65
7.2.00.0080.00516.79
7.1.330.0040.01115.59
7.1.320.0050.01115.84
7.1.310.0090.00615.49
7.1.300.0030.01215.60
7.1.290.0030.00815.83
7.1.280.0050.00915.78
7.1.270.0100.00515.73
7.1.260.0030.00915.73
7.1.250.0070.00615.67
7.1.240.0040.00715.79
7.1.230.0040.01115.71
7.1.220.0070.01015.83
7.1.210.0000.01515.86
7.1.200.0070.00715.75
7.1.190.0040.01115.58
7.1.180.0060.00915.41
7.1.170.0040.00815.80
7.1.160.0100.00015.67
7.1.150.0120.00415.73
7.1.140.0070.00715.70
7.1.130.0070.00715.80
7.1.120.0040.01115.75
7.1.110.0100.00715.50
7.1.100.0030.00715.77
7.1.90.0030.01015.95
7.1.80.0030.01015.88
7.1.70.0030.01016.25
7.1.60.0130.00617.36
7.1.50.0050.01116.30
7.1.40.0030.00715.61
7.1.30.0090.00615.55
7.1.20.0060.00915.66
7.1.10.0090.00615.45
7.1.00.0000.04619.10
7.0.330.0000.01615.10
7.0.320.0040.01115.43
7.0.310.0110.00315.30
7.0.300.0070.00715.35
7.0.290.0040.00415.15
7.0.280.0030.01315.47
7.0.270.0040.00715.38
7.0.260.0080.00815.44
7.0.250.0030.01015.30
7.0.240.0030.01015.34
7.0.230.0090.00615.36
7.0.220.0000.01215.39
7.0.210.0030.01015.32
7.0.200.0070.00415.92
7.0.190.0000.00915.23
7.0.180.0050.00515.38
7.0.170.0110.00415.40
7.0.160.0040.00815.37
7.0.150.0120.00315.37
7.0.140.0030.04018.64
7.0.130.0040.00815.52
7.0.120.0000.01115.48
7.0.110.0030.00715.15
7.0.100.0070.00715.58
7.0.90.0080.00015.45
7.0.80.0030.00915.02
7.0.70.0040.00815.42
7.0.60.0070.03817.79
7.0.50.0000.03216.75
7.0.40.0120.04116.93
7.0.30.0150.03516.68
7.0.20.0150.04716.70
7.0.10.0050.04816.89
7.0.00.0040.02616.66
5.6.400.0070.00714.25
5.6.390.0100.00714.11
5.6.380.0120.00014.81
5.6.370.0070.00714.38
5.6.360.0080.00814.61
5.6.350.0090.00314.73
5.6.340.0030.01014.37
5.6.330.0060.00614.50
5.6.320.0070.01014.43
5.6.310.0070.00714.39
5.6.300.0000.01114.28
5.6.290.0060.00914.22
5.6.280.0030.04517.95
5.6.270.0040.00814.57
5.6.260.0030.00914.46
5.6.250.0080.00814.57
5.6.240.0030.01214.52
5.6.230.0100.00314.55
5.6.220.0070.00714.35
5.6.210.0070.04717.63
5.6.200.0030.04616.33
5.6.190.0100.03717.46
5.6.180.1680.02517.42
5.6.170.0200.03817.45
5.6.160.0020.04317.40
5.6.150.0070.04416.28
5.6.140.0030.03016.41
5.6.130.0060.04816.24
5.6.120.0080.04417.85
5.6.110.0050.05017.94
5.6.100.0110.04117.76
5.6.90.0060.03817.64
5.6.80.0090.03217.46
5.6.70.1770.01717.41
5.6.60.0070.00714.55
5.6.50.0030.00614.28
5.6.40.0030.01214.34
5.6.30.0030.00714.46
5.6.20.0060.01214.29
5.6.10.0100.00614.45
5.6.00.0100.00014.41
5.5.380.0040.01214.25
5.5.370.0060.01214.50
5.5.360.0040.01114.15
5.5.350.0020.04417.39
5.5.340.0050.04816.30
5.5.330.0050.04917.07
5.5.320.2070.02217.33
5.5.310.0200.02517.49
5.5.300.0060.03016.30
5.5.290.0090.01816.02
5.5.280.0030.02517.76
5.5.270.0070.04817.53
5.5.260.0070.04717.57
5.5.250.0130.02317.34
5.5.240.0170.04217.22
5.5.230.0040.01114.26
5.5.220.0030.01014.37
5.5.210.0080.00314.28
5.5.200.0060.00614.52
5.5.190.0030.01014.32
5.5.180.0000.01514.16
5.5.170.0030.01414.27
5.5.160.0060.00614.47
5.5.150.0000.00914.12
5.5.140.0110.00414.11
5.5.130.0080.00814.44
5.5.120.0100.00314.09
5.5.110.0030.00914.18
5.5.100.0000.01313.96
5.5.90.0030.01114.13
5.5.80.0080.00414.19
5.5.70.0060.01214.31
5.5.60.0040.01214.45
5.5.50.0060.00914.04
5.5.40.0080.00414.37
5.5.30.0000.01414.42
5.5.20.0000.01313.96
5.5.10.0030.01314.05
5.5.00.0000.01014.33
5.4.450.0110.02716.27
5.4.440.0500.01616.31
5.4.430.0150.02316.21
5.4.420.0100.01916.25
5.4.410.0100.02116.16
5.4.400.0210.02016.07
5.4.390.0100.02316.15
5.4.380.0570.02915.87
5.4.370.0400.03115.77
5.4.360.0430.03215.89
5.4.350.0390.03115.75
5.4.340.0420.03215.90
5.4.330.0030.00313.05
5.4.320.0050.02412.78
5.4.310.0040.02312.78
5.4.300.0070.02012.79
5.4.290.0040.02412.78
5.4.280.0070.02512.73
5.4.270.0020.02612.73
5.4.260.0080.02012.73
5.4.250.0040.02312.73
5.4.240.0060.02112.73
5.4.230.0050.02412.73
5.4.220.0050.02212.72
5.4.210.0060.02012.73
5.4.200.0040.02312.72
5.4.190.0080.02312.72
5.4.180.0040.02412.72
5.4.170.0070.01812.73
5.4.160.0060.02012.73
5.4.150.0060.02012.73
5.4.140.0060.02412.57
5.4.130.0080.02012.56
5.4.120.0100.02212.54
5.4.110.0080.02412.54
5.4.100.0060.02712.54
5.4.90.0060.02612.54
5.4.80.0060.02712.54
5.4.70.0030.03012.54
5.4.60.0070.02212.54
5.4.50.0080.02212.54
5.4.40.0050.02212.53
5.4.30.0050.02212.53
5.4.20.0040.02112.53
5.4.10.0060.02212.53
5.4.00.0020.03012.27
5.3.290.0060.02312.93
5.3.280.0070.02512.88
5.3.270.0070.02112.88
5.3.260.0070.02212.88
5.3.250.0100.01812.88
5.3.240.0130.02212.88
5.3.230.0050.02312.88
5.3.220.0070.02312.87
5.3.210.0080.02112.87
5.3.200.0060.02712.87
5.3.190.0060.02512.86
5.3.180.0050.02712.86
5.3.170.0080.02112.86
5.3.160.0050.02312.86
5.3.150.0040.02012.86
5.3.140.0050.01912.86
5.3.130.0020.02412.86
5.3.120.0060.02412.86
5.3.110.0040.02812.86
5.3.100.0080.02312.60
5.3.90.0050.02512.59
5.3.80.0040.02212.59
5.3.70.0070.02212.59
5.3.60.0060.01712.58
5.3.50.0020.02312.55
5.3.40.0050.02012.55
5.3.30.0050.02012.53
5.3.20.0050.02512.42
5.3.10.0040.02312.40
5.3.00.0030.02212.40
5.2.170.0020.0339.24
5.2.160.0060.0289.23
5.2.150.0090.0279.24
5.2.140.0040.0339.23
5.2.130.0040.0309.20
5.2.120.0100.0259.20
5.2.110.0070.0279.20
5.2.100.0040.0299.20
5.2.90.0050.0299.20
5.2.80.0040.0319.19
5.2.70.0040.0309.20
5.2.60.0060.0299.15
5.2.50.0050.0309.12
5.2.40.0030.0309.09
5.2.30.0020.0339.07
5.2.20.0030.0309.06
5.2.10.0050.0318.96
5.2.00.0070.0328.83
5.1.60.0040.0328.11
5.1.50.0060.0298.11
5.1.40.0060.0298.09
5.1.30.0070.0288.43
5.1.20.0030.0378.46
5.1.10.0070.0288.19
5.1.00.0040.0358.19
5.0.50.0050.0196.66
5.0.40.0030.0306.53
5.0.30.0060.0376.34
5.0.20.0030.0366.31
5.0.10.0030.0276.29
5.0.00.0030.0396.27
4.4.90.0010.0174.77
4.4.80.0030.0154.76
4.4.70.0040.0144.75
4.4.60.0050.0254.75
4.4.50.0050.0184.77
4.4.40.0040.0244.71
4.4.30.0020.0164.76
4.4.20.0030.0154.84
4.4.10.0030.0224.85
4.4.00.0020.0264.76
4.3.110.0030.0154.67
4.3.100.0010.0164.66
4.3.90.0030.0144.63
4.3.80.0030.0244.58
4.3.70.0030.0154.63
4.3.60.0010.0164.63
4.3.50.0020.0164.63
4.3.40.0050.0214.53
4.3.30.0030.0153.30
4.3.20.0030.0163.28
4.3.10.0010.0163.23
4.3.00.0030.01715.27

preferences:
34.2 ms | 400 KiB | 5 Q