3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $userInput = 'YO264UU'; // remove all spaces and upper case $userInput = strtoupper(preg_replace('/\s+/', '', $userInput)); if (isValidPostcode($userInput)) { // Basic postcode formatting - add a space before the last 3 characters $formatted = substr($userInput, 0, -3) . ' ' . substr($userInput, -3); // now look up in db using $formatted } else { // invalid postcode! } var_dump($formatted);
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function isValidPostcode() in /in/LOWQJ:7 Stack trace: #0 {main} thrown in /in/LOWQJ on line 7
Process exited with code 255.
Output for 5.0.0 - 5.6.28, hhvm-3.12.0
Fatal error: Call to undefined function isValidPostcode() in /in/LOWQJ on line 7
Process exited with code 255.
Output for hhvm-3.10.0
Fatal error: Call to undefined function isValidPostcode() in /in/LOWQJ on line -1
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: isvalidpostcode() in /in/LOWQJ on line 7
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: isvalidpostcode() in /in/LOWQJ on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: isvalidpostcode() in /in/LOWQJ on line 7