3v4l.org

run code in 300+ PHP versions simultaneously
<?php $address = '5e Dorpsstraat 5-B'; $matchArr = array(); preg_match_all('/(\d+)/', $address, $matchArr); $houseNumber = array_pop($matchArr[0]); // strrpos om problemen te voorkomen bij straatnamen zoals 151th Avenue 151 $houseNumberStartPos = strrpos($address, $houseNumber); $streetName = substr($address, 0, $houseNumberStartPos); // Verwijder whitespace bij correcte notatie, geen -1 op strrpos voor foute notatie. // Voorbeeld Dorpsstraat 12 (correct), Dorpsstraat12 (incorrect). $streetName = trim($streetName); $houseNumberAdd = substr($address, ($houseNumberStartPos + strlen($houseNumber))); print $streetName . '<br />'; print $houseNumber . '<br />'; print $houseNumberAdd;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B9ekT
function name:  (null)
number of ops:  40
compiled vars:  !0 = $address, !1 = $matchArr, !2 = $houseNumber, !3 = $houseNumberStartPos, !4 = $streetName, !5 = $houseNumberAdd
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '5e+Dorpsstraat+5-B'
    4     1        ASSIGN                                                   !1, <array>
    5     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAL                                                 '%2F%28%5Cd%2B%29%2F'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !1
          6        DO_ICALL                                                 
    6     7        INIT_FCALL                                               'array_pop'
          8        FETCH_DIM_W                                      $9      !1, 0
          9        SEND_REF                                                 $9
         10        DO_ICALL                                         $10     
         11        ASSIGN                                                   !2, $10
    8    12        INIT_FCALL                                               'strrpos'
         13        SEND_VAR                                                 !0
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $12     
         16        ASSIGN                                                   !3, $12
    9    17        INIT_FCALL                                               'substr'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 0
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                         $14     
         22        ASSIGN                                                   !4, $14
   12    23        INIT_FCALL                                               'trim'
         24        SEND_VAR                                                 !4
         25        DO_ICALL                                         $16     
         26        ASSIGN                                                   !4, $16
   13    27        INIT_FCALL                                               'substr'
         28        SEND_VAR                                                 !0
         29        STRLEN                                           ~18     !2
         30        ADD                                              ~19     !3, ~18
         31        SEND_VAL                                                 ~19
         32        DO_ICALL                                         $20     
         33        ASSIGN                                                   !5, $20
   14    34        CONCAT                                           ~22     !4, '%3Cbr+%2F%3E'
         35        ECHO                                                     ~22
   15    36        CONCAT                                           ~23     !2, '%3Cbr+%2F%3E'
         37        ECHO                                                     ~23
   16    38        ECHO                                                     !5
         39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.26 ms | 1388 KiB | 23 Q