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); $service->getServiceStatus();

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.0100.00715.22
7.4.00.0050.01215.04
7.3.130.0110.00715.04
7.3.120.0080.00915.05
7.3.110.0120.00615.09
7.3.100.0070.01014.97
7.3.90.0030.01214.85
7.3.80.0060.00714.94
7.3.70.0050.01014.82
7.3.60.0080.00814.79
7.3.50.0070.00514.54
7.3.40.0050.01014.65
7.3.30.0100.00314.90
7.3.20.0050.00816.75
7.3.10.0100.00316.64
7.3.00.0060.00316.59
7.2.260.0040.01114.73
7.2.250.0070.01215.25
7.2.240.0100.00715.01
7.2.230.0060.00815.23
7.2.220.0080.00815.03
7.2.210.0090.00515.20
7.2.200.0060.00815.03
7.2.190.0050.00815.21
7.2.180.0060.00914.95
7.2.170.0090.00715.07
7.2.160.0050.00415.04
7.2.150.0070.00716.97
7.2.140.0090.00416.84
7.2.130.0080.00516.84
7.2.120.0050.00917.08
7.2.110.0070.00517.07
7.2.100.0040.00916.96
7.2.90.0030.01116.83
7.2.80.0090.00517.07
7.2.70.0050.01016.84
7.2.60.0060.00817.02
7.2.50.0050.00716.78
7.2.40.0070.01016.96
7.2.30.0040.00716.98
7.2.20.0090.00616.92
7.2.10.0050.00817.02
7.2.00.0050.01216.89
7.1.330.0030.01215.60
7.1.320.0080.00615.76
7.1.310.0040.01015.56
7.1.300.0050.01015.69
7.1.290.0070.00815.77
7.1.280.0090.00415.71
7.1.270.0050.00715.67
7.1.260.0080.00815.74
7.1.250.0020.01015.65
7.1.240.0070.00915.90
7.1.230.0070.00415.87
7.1.220.0050.00515.70
7.1.210.0050.01015.72
7.1.200.0040.00915.69
7.1.190.0030.01015.75
7.1.180.0020.00715.66
7.1.170.0090.00515.43
7.1.160.0080.00715.81
7.1.150.0050.00815.77
7.1.140.0060.00515.75
7.1.130.0050.00815.46
7.1.120.0060.00715.58
7.1.110.0040.00515.70
7.1.100.0030.00615.57
7.1.90.0000.01115.84
7.1.80.0070.00515.86
7.1.70.0050.00716.10
7.1.60.0080.01016.96
7.1.50.0060.00516.17
7.1.40.0050.00815.87
7.1.30.0070.00915.71
7.1.20.0080.00815.75
7.1.10.0050.01015.76
7.1.00.0070.02918.06
7.0.330.0070.00515.23
7.0.320.0060.00615.40
7.0.310.0030.00815.40
7.0.300.0060.00615.26
7.0.290.0060.00915.28
7.0.280.0070.00315.43
7.0.270.0030.01015.43
7.0.260.0070.00415.44
7.0.250.0030.01015.26
7.0.240.0050.00715.29
7.0.230.0060.00615.47
7.0.220.0060.00515.48
7.0.210.0060.00915.41
7.0.200.0040.00616.01
7.0.190.0050.00815.42
7.0.180.0040.00915.46
7.0.170.0060.00715.35
7.0.160.0030.01015.36
7.0.150.0030.00815.31
7.0.140.0050.02717.62
7.0.130.0080.00515.37
7.0.120.0050.00915.41
7.0.110.0030.01015.47
7.0.100.0100.00315.29
7.0.90.0060.00615.57
7.0.80.0050.00315.40
7.0.70.0070.00415.49
7.0.60.0060.02616.96
7.0.50.0030.03316.29
7.0.40.0070.02015.60
7.0.30.0210.02815.76
7.0.20.0120.03015.61
7.0.10.0070.02415.71
7.0.00.0060.03415.63
5.6.400.0030.01014.82
5.6.390.0080.00514.61
5.6.380.0110.00014.66
5.6.370.0030.00814.54
5.6.360.0070.00914.65
5.6.350.0050.00814.31
5.6.340.0050.00814.60
5.6.330.0050.00514.50
5.6.320.0080.00514.43
5.6.310.0040.01214.52
5.6.300.0030.00714.68
5.6.290.0030.01014.50
5.6.280.0040.03016.69
5.6.270.0020.01214.57
5.6.260.0040.00814.68
5.6.250.0090.00314.44
5.6.240.0030.01014.52
5.6.230.0050.01114.51
5.6.220.0070.00414.63
5.6.210.0050.01916.42
5.6.200.0070.01815.90
5.6.190.0060.02016.61
5.6.180.1020.02316.45
5.6.170.0130.02716.45
5.6.160.0070.02116.58
5.6.150.0060.02015.68
5.6.140.0080.01415.92
5.6.130.0050.03215.69
5.6.120.0050.02616.62
5.6.110.0050.03516.68
5.6.100.0090.02716.76
5.6.90.0040.03216.55
5.6.80.0070.01516.41
5.6.70.0150.02016.39
5.6.60.0060.00614.53
5.6.50.0060.00914.34
5.6.40.0060.00514.25
5.6.30.0040.01114.46
5.6.20.0070.00514.28
5.6.10.0070.00514.47
5.6.00.0030.01014.48
5.5.380.0090.00314.30
5.5.370.0050.01114.66
5.5.360.0080.00814.54
5.5.350.0050.03216.49
5.5.340.0070.03015.78
5.5.330.0050.02116.48
5.5.320.1450.01416.47
5.5.310.0080.02116.46
5.5.300.0030.01915.56
5.5.290.0100.02815.56
5.5.280.0090.02716.55
5.5.270.0060.02516.61
5.5.260.0080.03016.60
5.5.250.0080.03316.41
5.5.240.0150.02416.32
5.5.230.0070.00514.44
5.5.220.0040.00914.60
5.5.210.0070.00414.30
5.5.200.0040.00714.28
5.5.190.0060.00714.32
5.5.180.0090.00614.50
5.5.170.0080.00714.37
5.5.160.0070.00814.36
5.5.150.0050.00814.35
5.5.140.0070.00614.29
5.5.130.0050.00814.24
5.5.120.0020.01114.30
5.5.110.0060.00614.34
5.5.100.0070.00414.63
5.5.90.0050.00714.55
5.5.80.0030.01014.40
5.5.70.0020.01014.40
5.5.60.0030.00914.39
5.5.50.0040.00614.58
5.5.40.0030.00714.35
5.5.30.0030.00914.30
5.5.20.0070.00714.59
5.5.10.0030.00714.18
5.5.00.0070.00414.31
5.4.450.0250.01715.04
5.4.440.0080.01815.04
5.4.430.0080.01715.03
5.4.420.0150.01715.07
5.4.410.0110.01815.02
5.4.400.0060.01714.93
5.4.390.0090.01814.88
5.4.380.0250.02314.73
5.4.370.0420.01614.74
5.4.360.0250.03114.72
5.4.350.0450.02514.75
5.4.340.0300.02114.72
5.4.330.0060.00712.82
5.4.320.0070.01512.72
5.4.310.0050.01712.72
5.4.300.0070.01312.72
5.4.290.0040.01812.72
5.4.280.0030.01612.68
5.4.270.0060.01712.68
5.4.260.0030.01712.68
5.4.250.0060.01512.68
5.4.240.0060.01412.68
5.4.230.0050.01912.68
5.4.220.0050.01812.68
5.4.210.0040.01712.68
5.4.200.0050.01612.68
5.4.190.0050.01612.68
5.4.180.0070.01412.68
5.4.170.0060.01612.68
5.4.160.0080.01912.68
5.4.150.0040.01512.68
5.4.140.0020.01712.57
5.4.130.0050.01512.57
5.4.120.0030.01512.56
5.4.110.0040.01812.56
5.4.100.0040.01912.56
5.4.90.0020.01912.56
5.4.80.0030.01512.56
5.4.70.0060.01612.55
5.4.60.0030.01612.55
5.4.50.0060.01812.55
5.4.40.0050.01612.55
5.4.30.0040.01612.55
5.4.20.0060.01712.55
5.4.10.0050.01312.55
5.4.00.0030.01812.38
5.3.290.0060.01412.81
5.3.280.0050.01712.78
5.3.270.0040.01612.79
5.3.260.0050.01612.79
5.3.250.0020.01712.79
5.3.240.0070.01712.79
5.3.230.0050.01412.78
5.3.220.0040.01812.77
5.3.210.0050.01512.77
5.3.200.0040.02012.77
5.3.190.0030.01612.77
5.3.180.0060.01612.77
5.3.170.0040.01612.77
5.3.160.0050.01812.77
5.3.150.0050.01612.77
5.3.140.0050.01512.77
5.3.130.0030.02112.77
5.3.120.0060.02012.77
5.3.110.0060.01612.77
5.3.100.0020.01912.60
5.3.90.0080.01412.59
5.3.80.0040.01712.59
5.3.70.0040.01812.59
5.3.60.0030.01912.58
5.3.50.0030.01412.56
5.3.40.0050.01412.56
5.3.30.0050.01712.55
5.3.20.0040.01612.48
5.3.10.0030.01612.47
5.3.00.0050.01612.46
5.2.170.0050.0309.25
5.2.160.0040.0299.25
5.2.150.0080.0279.25
5.2.140.0050.0299.24
5.2.130.0060.0279.20
5.2.120.0040.0299.20
5.2.110.0060.0289.21
5.2.100.0050.0299.20
5.2.90.0040.0369.20
5.2.80.0040.0339.20
5.2.70.0030.0369.20
5.2.60.0050.0319.16
5.2.50.0040.0299.12
5.2.40.0050.0299.10
5.2.30.0080.0279.07
5.2.20.0060.0279.06
5.2.10.0040.0288.96
5.2.00.0020.0348.83
5.1.60.0040.0278.11
5.1.50.0060.0288.11
5.1.40.0070.0258.09
5.1.30.0040.0298.44
5.1.20.0040.0308.46
5.1.10.0070.0238.19
5.1.00.0050.0258.19
5.0.50.0050.0256.67
5.0.40.0020.0226.53
5.0.30.0050.0336.34
5.0.20.0030.0186.31
5.0.10.0060.0246.28
5.0.00.0030.0316.28
4.4.90.0040.0194.78
4.4.80.0050.0174.76
4.4.70.0060.0124.75
4.4.60.0030.0154.76
4.4.50.0010.0164.77
4.4.40.0030.0294.71
4.4.30.0030.0154.76
4.4.20.0030.0184.84
4.4.10.0040.0154.85
4.4.00.0020.0264.76
4.3.110.0020.0164.67
4.3.100.0010.0164.66
4.3.90.0030.0144.63
4.3.80.0040.0234.59
4.3.70.0050.0124.63
4.3.60.0020.0154.63
4.3.50.0050.0134.62
4.3.40.0020.0254.54
4.3.30.0010.0183.30
4.3.20.0040.0133.28
4.3.10.0010.0163.24
4.3.00.0000.01315.27

preferences:
37.36 ms | 401 KiB | 5 Q