3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 27
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/LOWQJ
function name:  (null)
number of ops:  31
compiled vars:  !0 = $userInput, !1 = $formatted
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'YO264UU'
    5     1        INIT_FCALL                                               'strtoupper'
          2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%2F%5Cs%2B%2F'
          4        SEND_VAL                                                 ''
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                         $4      
          9        ASSIGN                                                   !0, $4
    7    10        INIT_FCALL_BY_NAME                                       'isValidPostcode'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0  $6      
         13      > JMPZ                                                     $6, ->27
    9    14    >   INIT_FCALL                                               'substr'
         15        SEND_VAR                                                 !0
         16        SEND_VAL                                                 0
         17        SEND_VAL                                                 -3
         18        DO_ICALL                                         $7      
         19        CONCAT                                           ~8      $7, '+'
         20        INIT_FCALL                                               'substr'
         21        SEND_VAR                                                 !0
         22        SEND_VAL                                                 -3
         23        DO_ICALL                                         $9      
         24        CONCAT                                           ~10     ~8, $9
         25        ASSIGN                                                   !1, ~10
         26      > JMP                                                      ->27
   15    27    >   INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.14 ms | 1396 KiB | 21 Q