3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $tries = 0; $regenerateLimit = 10; do { if ($tries++ > $regenerateLimit) { throw new \RuntimeException(sprintf('Generation failed after %d tries', $tries)); } $orderNumber = $this->randomGenerator->generate(10000, 99999); } while (in_array($orderNumber, [2, 5])); echo $orderNumber;
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/V9969:11 Stack trace: #0 {main} thrown in /in/V9969 on line 11
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Fatal error: Using $this when not in object context in /in/V9969 on line 11
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/V9969 on line 13
Process exited with code 255.