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 (true || 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 = 11, Position 2 = 24
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/FiphL
function name:  (null)
number of ops:  28
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      > JMPZ                                                     <true>, ->24
    9    11    >   INIT_FCALL                                               'substr'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 0
         14        SEND_VAL                                                 -3
         15        DO_ICALL                                         $6      
         16        CONCAT                                           ~7      $6, '+'
         17        INIT_FCALL                                               'substr'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 -3
         20        DO_ICALL                                         $8      
         21        CONCAT                                           ~9      ~7, $8
         22        ASSIGN                                                   !1, ~9
         23      > JMP                                                      ->24
   15    24    >   INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.38 ms | 1395 KiB | 21 Q