3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ServiceLocator { public function getBuzzer() { return new Buzzer; } } class Buzzer { public function __construct() { sleep(5); } public function buzz() { echo "Buzz!"; } } class BuzzerProxy extends Buzzer { protected $sl; protected $initialized; protected $instance; public function __construct(ServiceLocator $sl) { $this->sl = $sl; } private function initialize() { $this->instance = $this->sl->getBuzzer(); $this->initialized = true; } public function buzz() { if (!$this->initialized) {$this->initialize();} return $this->instance->buzz(); } } $now = microtime(); $sl = new ServiceLocator; echo "Created service locator in " . microtime() - $now . "ms\n"; $now = microtime(); $proxy = new BuzzerProxy($sl); echo "Created buzzer proxy in " . microtime() - $now . "ms\n"; $now = microtime(); $proxy->buzz(); echo "Buzzed after " . microtime() - $now . "ms\n";
Output for 7.2.0
Warning: A non-numeric value encountered in /in/7J10A on line 50 Notice: A non well formed numeric value encountered in /in/7J10A on line 50 -0.002855ms Warning: A non-numeric value encountered in /in/7J10A on line 54 Notice: A non well formed numeric value encountered in /in/7J10A on line 54 -0.002899ms
Process exited with code 137.
Output for 7.1.7
Warning: A non-numeric value encountered in /in/7J10A on line 50 Notice: A non well formed numeric value encountered in /in/7J10A on line 50 -0.00244ms Warning: A non-numeric value encountered in /in/7J10A on line 54 Notice: A non well formed numeric value encountered in /in/7J10A on line 54 -0.002467ms
Process exited with code 137.
Output for 7.1.6
Warning: A non-numeric value encountered in /in/7J10A on line 50 Notice: A non well formed numeric value encountered in /in/7J10A on line 50 -0.006246ms Warning: A non-numeric value encountered in /in/7J10A on line 54 Notice: A non well formed numeric value encountered in /in/7J10A on line 54 -0.006296ms
Process exited with code 137.
Output for 7.1.5
Warning: A non-numeric value encountered in /in/7J10A on line 50 Notice: A non well formed numeric value encountered in /in/7J10A on line 50 -0.007622ms Warning: A non-numeric value encountered in /in/7J10A on line 54 Notice: A non well formed numeric value encountered in /in/7J10A on line 54 -0.007664ms
Process exited with code 137.
Output for 7.1.0
Warning: A non-numeric value encountered in /in/7J10A on line 50 Notice: A non well formed numeric value encountered in /in/7J10A on line 50 -0.003684ms Warning: A non-numeric value encountered in /in/7J10A on line 54 Notice: A non well formed numeric value encountered in /in/7J10A on line 54 -0.00371ms
Process exited with code 137.
Output for 7.0.20
-0.002518ms -0.002544ms
Process exited with code 137.
Output for 7.0.14
-0.003602ms -0.00363ms
Process exited with code 137.
Output for 7.0.10
-0.003297ms -0.003324ms
Process exited with code 137.
Output for 7.0.9
-0.003687ms -0.003713ms
Process exited with code 137.
Output for 7.0.8
-0.002881ms -0.002908ms
Process exited with code 137.
Output for 7.0.7
-0.003529ms -0.003556ms
Process exited with code 137.
Output for 7.0.6
-0.003125ms -0.003147ms
Process exited with code 137.
Output for 7.0.5
-0.003624ms -0.003644ms
Process exited with code 137.
Output for 7.0.4
-0.004111ms -0.004142ms
Process exited with code 137.
Output for 7.0.3
-0.002634ms -0.002656ms
Process exited with code 137.
Output for 7.0.2
-0.003744ms -0.003784ms
Process exited with code 137.
Output for 7.0.1
-0.003737ms -0.003762ms
Process exited with code 137.
Output for 7.0.0
-0.004357ms -0.004386ms
Process exited with code 137.
Output for 5.6.28
-0.004792ms -0.004822ms
Process exited with code 137.
Output for 5.6.25
-0.004406ms -0.00444ms
Process exited with code 137.
Output for 5.6.24
-0.003913ms -0.003941ms
Process exited with code 137.
Output for 5.6.23
-0.003033ms -0.003053ms
Process exited with code 137.
Output for 5.6.22
-0.004187ms -0.004217ms
Process exited with code 137.
Output for 5.6.21
-0.003311ms -0.003335ms
Process exited with code 137.
Output for 5.6.20
-0.005332ms -0.005372ms
Process exited with code 137.
Output for 5.6.19
-0.006037ms -0.006085ms
Process exited with code 137.
Output for 5.6.18
-0.00563ms -0.005677ms
Process exited with code 137.
Output for 5.6.17
-0.004781ms -0.004813ms
Process exited with code 137.
Output for 5.6.16
-0.00431ms -0.00434ms
Process exited with code 137.
Output for 5.6.15
-0.003068ms -0.00309ms
Process exited with code 137.
Output for 5.6.14
-0.003416ms -0.003443ms
Process exited with code 137.
Output for 5.6.13
-0.003196ms -0.003224ms
Process exited with code 137.
Output for 5.6.12
-0.004126ms -0.004153ms
Process exited with code 137.
Output for 5.6.11
-0.004612ms -0.004643ms
Process exited with code 137.
Output for 5.6.10
-0.004724ms -0.004755ms
Process exited with code 137.
Output for 5.6.9
-0.005055ms -0.005093ms
Process exited with code 137.
Output for 5.6.8
-0.005563ms -0.005606ms
Process exited with code 137.
Output for 5.6.7
-0.00465ms -0.00468ms
Process exited with code 137.
Output for 5.6.6
-0.003336ms -0.003357ms
Process exited with code 137.
Output for 5.6.5
-0.007426ms -0.007469ms
Process exited with code 137.
Output for 5.6.4
-0.004469ms -0.004497ms
Process exited with code 137.
Output for 5.6.3
-0.004846ms -0.004878ms
Process exited with code 137.
Output for 5.6.2
-0.004703ms -0.004744ms
Process exited with code 137.
Output for 5.6.1
-0.004295ms -0.004329ms
Process exited with code 137.
Output for 5.6.0
-0.004708ms -0.00474ms
Process exited with code 137.
Output for 5.5.38
-0.005123ms -0.005164ms
Process exited with code 137.
Output for 5.5.37
-0.004238ms -0.004268ms
Process exited with code 137.
Output for 5.5.36
-0.005047ms -0.005116ms
Process exited with code 137.
Output for 5.5.35
-0.003019ms -0.003042ms
Process exited with code 137.
Output for 5.5.34
-0.00639ms -0.006515ms
Process exited with code 137.
Output for 5.5.33
-0.005487ms -0.005531ms
Process exited with code 137.
Output for 5.5.32
-0.00435ms -0.004379ms
Process exited with code 137.
Output for 5.5.31
-0.003243ms -0.003267ms
Process exited with code 137.
Output for 5.5.30
-0.003018ms -0.003041ms
Process exited with code 137.
Output for 5.5.29
-0.005509ms -0.005609ms
Process exited with code 137.
Output for 5.5.28
-0.005437ms -0.005645ms
Process exited with code 137.
Output for 5.5.27
-0.007546ms -0.007616ms
Process exited with code 137.
Output for 5.5.26
-0.005027ms -0.005083ms
Process exited with code 137.
Output for 5.5.25
-0.007177ms -0.007219ms
Process exited with code 137.
Output for 5.5.24
-0.007761ms -0.007885ms
Process exited with code 137.
Output for 5.5.23
-0.002878ms -0.002899ms
Process exited with code 137.
Output for 5.5.22
-0.003207ms -0.003232ms
Process exited with code 137.
Output for 5.5.21
-0.004676ms -0.004706ms
Process exited with code 137.
Output for 5.5.20
-0.003589ms -0.003616ms
Process exited with code 137.
Output for 5.5.19
-0.007514ms -0.007558ms
Process exited with code 137.
Output for 5.5.18
-0.007317ms -0.007434ms
Process exited with code 137.
Output for 5.5.16
-0.004686ms -0.00472ms
Process exited with code 137.
Output for 5.5.15
-0.003714ms -0.003739ms
Process exited with code 137.
Output for 5.5.14
-0.002929ms -0.002951ms
Process exited with code 137.
Output for 5.5.13
-0.006377ms -0.006456ms
Process exited with code 137.
Output for 5.5.12
-0.005642ms -0.005744ms
Process exited with code 137.
Output for 5.5.11
-0.007401ms -0.007508ms
Process exited with code 137.
Output for 5.5.10
-0.004456ms -0.004487ms
Process exited with code 137.
Output for 5.5.9
-0.005288ms -0.005326ms
Process exited with code 137.
Output for 5.5.8
-0.007968ms -0.008087ms
Process exited with code 137.
Output for 5.5.7
-0.006423ms -0.006589ms
Process exited with code 137.
Output for 5.5.6
-0.007237ms -0.00737ms
Process exited with code 137.
Output for 5.5.5
-0.005177ms -0.005235ms
Process exited with code 137.
Output for 5.5.4
-0.006194ms -0.006246ms
Process exited with code 137.
Output for 5.5.3
-0.005458ms -0.005567ms
Process exited with code 137.
Output for 5.5.2
-0.005251ms -0.005369ms
Process exited with code 137.
Output for 5.5.1
-0.005417ms -0.005452ms
Process exited with code 137.
Output for 5.5.0
-0.006734ms -0.00678ms
Process exited with code 137.
Output for 5.4.45
-0.006111ms -0.006223ms
Process exited with code 137.
Output for 5.4.44
-0.004012ms -0.004049ms
Process exited with code 137.
Output for 5.4.43
-0.00647ms -0.006616ms
Process exited with code 137.
Output for 5.4.42
-0.005207ms -0.005339ms
Process exited with code 137.
Output for 5.4.41
-0.005123ms -0.005252ms
Process exited with code 137.
Output for 5.4.40
-0.0058ms -0.005927ms
Process exited with code 137.
Output for 5.4.39
-0.003722ms -0.003764ms
Process exited with code 137.
Output for 5.4.38
-0.004691ms -0.004754ms
Process exited with code 137.
Output for 5.4.37
-0.004243ms -0.00429ms
Process exited with code 137.
Output for 5.4.36
-0.004319ms -0.004373ms
Process exited with code 137.
Output for 5.4.35
-0.003842ms -0.003875ms
Process exited with code 137.
Output for 5.4.34
-0.004751ms -0.004794ms
Process exited with code 137.
Output for 5.4.32
-0.003532ms -0.003569ms
Process exited with code 137.
Output for 5.4.31
-0.006879ms -0.007065ms
Process exited with code 137.
Output for 5.4.30
-0.005655ms -0.005787ms
Process exited with code 137.
Output for 5.4.29
-0.003438ms -0.003466ms
Process exited with code 137.
Output for 5.4.28
-0.006339ms -0.006487ms
Process exited with code 137.
Output for 5.4.27
-0.004336ms -0.004373ms
Process exited with code 137.
Output for 5.4.26
-0.005321ms -0.005391ms
Process exited with code 137.
Output for 5.4.25
-0.00658ms -0.006649ms
Process exited with code 137.
Output for 5.4.24
-0.004413ms -0.004451ms
Process exited with code 137.
Output for 5.4.23
-0.006203ms -0.006279ms
Process exited with code 137.
Output for 5.4.22
-0.002949ms -0.002978ms
Process exited with code 137.
Output for 5.4.21
-0.00654ms -0.00668ms
Process exited with code 137.
Output for 5.4.20
-0.005946ms -0.005994ms
Process exited with code 137.
Output for 5.4.19
-0.003101ms -0.003141ms
Process exited with code 137.
Output for 5.4.18
-0.004948ms -0.004986ms
Process exited with code 137.
Output for 5.4.17
-0.004087ms -0.004123ms
Process exited with code 137.
Output for 5.4.16
-0.004363ms -0.004405ms
Process exited with code 137.
Output for 5.4.15
-0.003532ms -0.003565ms
Process exited with code 137.
Output for 5.4.14
-0.001948ms -0.001978ms
Process exited with code 137.
Output for 5.4.13
-0.002733ms -0.002835ms
Process exited with code 137.
Output for 5.4.12
-0.002212ms -0.002245ms
Process exited with code 137.
Output for 5.4.11
-0.002544ms -0.002653ms
Process exited with code 137.
Output for 5.4.10
-0.002504ms -0.002544ms
Process exited with code 137.
Output for 5.4.9
-0.002116ms -0.002151ms
Process exited with code 137.
Output for 5.4.8
-0.001458ms -0.001484ms
Process exited with code 137.
Output for 5.4.7
-0.001862ms -0.001893ms
Process exited with code 137.
Output for 5.4.6
-0.002105ms -0.002139ms
Process exited with code 137.
Output for 5.4.5
-0.001699ms -0.001732ms
Process exited with code 137.
Output for 5.4.4
-0.002164ms -0.002199ms
Process exited with code 137.
Output for 5.4.3
-0.002387ms -0.002425ms
Process exited with code 137.
Output for 5.4.2
-0.002927ms -0.002999ms
Process exited with code 137.
Output for 5.4.1
-0.002631ms -0.002685ms
Process exited with code 137.
Output for 5.4.0
-0.00373ms -0.003856ms
Process exited with code 137.
Output for 5.3.29
-0.002883ms -0.002913ms
Process exited with code 137.
Output for 5.3.28
-0.018377ms -0.01842ms
Process exited with code 137.
Output for 5.3.27
-0.002066ms -0.002097ms
Process exited with code 137.
Output for 5.3.26
-0.004188ms -0.00432ms
Process exited with code 137.
Output for 5.3.25
-0.003124ms -0.003245ms
Process exited with code 137.
Output for 5.3.24
-0.002741ms -0.002781ms
Process exited with code 137.
Output for 5.3.23
-0.004033ms -0.004093ms
Process exited with code 137.
Output for 5.3.22
-0.003045ms -0.003164ms
Process exited with code 137.
Output for 5.3.21
-0.004485ms -0.004545ms
Process exited with code 137.
Output for 5.3.20
-0.003351ms -0.003424ms
Process exited with code 137.
Output for 5.3.19
-0.001592ms -0.001617ms
Process exited with code 137.
Output for 5.3.18
-0.003767ms -0.003834ms
Process exited with code 137.
Output for 5.3.17
-0.002543ms -0.00258ms
Process exited with code 137.
Output for 5.3.16
-0.002606ms -0.002716ms
Process exited with code 137.
Output for 5.3.15
-0.002414ms -0.002449ms
Process exited with code 137.
Output for 5.3.14
-0.002835ms -0.002878ms
Process exited with code 137.
Output for 5.3.13
-0.002841ms -0.00289ms
Process exited with code 137.
Output for 5.3.12
-0.002168ms -0.002201ms
Process exited with code 137.
Output for 5.3.11
-0.002069ms -0.002099ms
Process exited with code 137.
Output for 5.3.10
-0.002998ms -0.003099ms
Process exited with code 137.
Output for 5.3.9
-0.002176ms -0.002207ms
Process exited with code 137.
Output for 5.3.8
-0.004417ms -0.004481ms
Process exited with code 137.
Output for 5.3.7
-0.004082ms -0.004214ms
Process exited with code 137.
Output for 5.3.6
-0.003977ms -0.004051ms
Process exited with code 137.
Output for 5.3.5
-0.002042ms -0.002073ms
Process exited with code 137.
Output for 5.3.4
-0.003814ms -0.003875ms
Process exited with code 137.
Output for 5.3.3
-0.004137ms -0.004196ms
Process exited with code 137.
Output for 5.3.2
-0.002776ms -0.002897ms
Process exited with code 137.
Output for 5.3.1
-0.00266ms -0.002773ms
Process exited with code 137.
Output for 5.3.0
-0.003624ms -0.003682ms
Process exited with code 137.
Output for 5.2.17
-0.003354ms -0.0035ms
Process exited with code 137.
Output for 5.2.16
-0.003215ms -0.003372ms
Process exited with code 137.
Output for 5.2.15
-0.00205ms -0.002086ms
Process exited with code 137.
Output for 5.2.14
-0.002196ms -0.002319ms
Process exited with code 137.
Output for 5.2.13
-0.001972ms -0.002007ms
Process exited with code 137.
Output for 5.2.12
-0.002174ms -0.002297ms
Process exited with code 137.
Output for 5.2.11
-0.002081ms -0.002119ms
Process exited with code 137.
Output for 5.2.10
-0.003273ms -0.00342ms
Process exited with code 137.
Output for 5.2.9
-0.002038ms -0.002148ms
Process exited with code 137.
Output for 5.2.8
-0.002693ms -0.002756ms
Process exited with code 137.
Output for 5.2.7
-0.001632ms -0.00166ms
Process exited with code 137.
Output for 5.2.6
-0.00147ms -0.001496ms
Process exited with code 137.
Output for 5.2.5
-0.002584ms -0.002678ms
Process exited with code 137.
Output for 5.2.4
-0.003008ms -0.003074ms
Process exited with code 137.
Output for 5.2.3
-0.002203ms -0.00226ms
Process exited with code 137.
Output for 5.2.2
-0.00203ms -0.002102ms
Process exited with code 137.
Output for 5.2.1
-0.001953ms -0.001998ms
Process exited with code 137.
Output for 5.2.0
-0.00193ms -0.001964ms
Process exited with code 137.
Output for 5.1.6
-0.002037ms -0.002184ms
Process exited with code 137.
Output for 5.1.5
-0.002955ms -0.003028ms
Process exited with code 137.
Output for 5.1.4
-0.002945ms -0.003002ms
Process exited with code 137.
Output for 5.1.3
-0.001901ms -0.001938ms
Process exited with code 137.
Output for 5.1.2
-0.002054ms -0.002167ms
Process exited with code 137.
Output for 5.1.1
-0.001476ms -0.001509ms
Process exited with code 137.
Output for 5.1.0
-0.001679ms -0.001721ms
Process exited with code 137.
Output for 5.0.5
-0.000752ms -0.000792ms
Process exited with code 137.
Output for 5.0.4
-0.000789ms -0.00083ms
Process exited with code 137.
Output for 5.0.3
-0.001229ms -0.001297ms
Process exited with code 137.
Output for 5.0.2
-0.000962ms -0.00102ms
Process exited with code 137.
Output for 5.0.1
-0.000764ms -0.000796ms
Process exited with code 137.
Output for 5.0.0
-0.000635ms -0.000663ms
Process exited with code 137.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/7J10A on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/7J10A on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/7J10A on line 4
Process exited with code 255.

preferences:
178.7 ms | 401 KiB | 216 Q