3v4l.org

run code in 300+ PHP versions simultaneously
<?php function str_to_address($context) { $array = explode(" ", $context); $array_reversed = array_reverse($array); $numKey = ""; $zipKey = ""; foreach($array_reversed as $k=>$str) { if($zipKey) { continue; } if(strlen($str)===5 && is_numeric($str)) { $zipKey = $k; } } $array_reversed = array_slice($array_reversed, $zipKey); $array = array_reverse($array_reversed); foreach($array as $k=>$str) { if($numKey) { continue; } if(strlen($str)>1 && strlen($str)<6 && is_numeric($str)) { $numKey = $k; } } $array = array_slice($array, $numKey); $string = implode(' ', $array); return $string; } echo str_to_address("Sally sells seashells at 452 Parks Way, Lemons, GA 45243 and loves it."); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qE1Xp
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_FCALL                                               'str_to_address'
          1        SEND_VAL                                                 'Sally+sells+seashells+at+452+Parks+Way%2C+Lemons%2C+GA+45243+and+loves+it.'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   27     4      > RETURN                                                   1

Function str_to_address:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 27
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 27
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 26
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 26
Branch analysis from position: 24
Branch analysis from position: 27
2 jumps found. (Code = 77) Position 1 = 38, Position 2 = 56
Branch analysis from position: 38
2 jumps found. (Code = 78) Position 1 = 39, Position 2 = 56
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 42
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 42
2 jumps found. (Code = 46) Position 1 = 45, Position 2 = 48
Branch analysis from position: 45
2 jumps found. (Code = 46) Position 1 = 49, Position 2 = 53
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 55
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 55
Branch analysis from position: 53
Branch analysis from position: 48
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
Branch analysis from position: 27
filename:       /in/qE1Xp
function name:  str_to_address
number of ops:  69
compiled vars:  !0 = $context, !1 = $array, !2 = $array_reversed, !3 = $numKey, !4 = $zipKey, !5 = $str, !6 = $k, !7 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !1, $8
    4     6        INIT_FCALL                                               'array_reverse'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $10     
          9        ASSIGN                                                   !2, $10
    5    10        ASSIGN                                                   !3, ''
    6    11        ASSIGN                                                   !4, ''
    7    12      > FE_RESET_R                                       $14     !2, ->27
         13    > > FE_FETCH_R                                       ~15     $14, !5, ->27
         14    >   ASSIGN                                                   !6, ~15
    8    15      > JMPZ                                                     !4, ->17
         16    > > JMP                                                      ->13
    9    17    >   STRLEN                                           ~17     !5
         18        IS_IDENTICAL                                     ~18     ~17, 5
         19      > JMPZ_EX                                          ~18     ~18, ->24
         20    >   INIT_FCALL                                               'is_numeric'
         21        SEND_VAR                                                 !5
         22        DO_ICALL                                         $19     
         23        BOOL                                             ~18     $19
         24    > > JMPZ                                                     ~18, ->26
   10    25    >   ASSIGN                                                   !4, !6
    7    26    > > JMP                                                      ->13
         27    >   FE_FREE                                                  $14
   13    28        INIT_FCALL                                               'array_slice'
         29        SEND_VAR                                                 !2
         30        SEND_VAR                                                 !4
         31        DO_ICALL                                         $21     
         32        ASSIGN                                                   !2, $21
   14    33        INIT_FCALL                                               'array_reverse'
         34        SEND_VAR                                                 !2
         35        DO_ICALL                                         $23     
         36        ASSIGN                                                   !1, $23
   15    37      > FE_RESET_R                                       $25     !1, ->56
         38    > > FE_FETCH_R                                       ~26     $25, !5, ->56
         39    >   ASSIGN                                                   !6, ~26
   16    40      > JMPZ                                                     !3, ->42
         41    > > JMP                                                      ->38
   17    42    >   STRLEN                                           ~28     !5
         43        IS_SMALLER                                       ~29     1, ~28
         44      > JMPZ_EX                                          ~29     ~29, ->48
         45    >   STRLEN                                           ~30     !5
         46        IS_SMALLER                                       ~31     ~30, 6
         47        BOOL                                             ~29     ~31
         48    > > JMPZ_EX                                          ~29     ~29, ->53
         49    >   INIT_FCALL                                               'is_numeric'
         50        SEND_VAR                                                 !5
         51        DO_ICALL                                         $32     
         52        BOOL                                             ~29     $32
         53    > > JMPZ                                                     ~29, ->55
   18    54    >   ASSIGN                                                   !3, !6
   15    55    > > JMP                                                      ->38
         56    >   FE_FREE                                                  $25
   22    57        INIT_FCALL                                               'array_slice'
         58        SEND_VAR                                                 !1
         59        SEND_VAR                                                 !3
         60        DO_ICALL                                         $34     
         61        ASSIGN                                                   !1, $34
   23    62        INIT_FCALL                                               'implode'
         63        SEND_VAL                                                 '+'
         64        SEND_VAR                                                 !1
         65        DO_ICALL                                         $36     
         66        ASSIGN                                                   !7, $36
   24    67      > RETURN                                                   !7
   25    68*     > RETURN                                                   null

End of function str_to_address

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.9 ms | 1407 KiB | 24 Q