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 = sprintf('%05d%05d', $this->randomGenerator->generate(10000, 99999), $this->randomGenerator->generate(0, 99999)); } while (in_array($orderNumber, [2, 5])); echo $orderNumber;
based on p7Cge
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/oIkot:12 Stack trace: #0 {main} thrown in /in/oIkot on line 12
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Fatal error: Using $this when not in object context in /in/oIkot on line 12
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/oIkot on line 14
Process exited with code 255.