3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ad = "123 Main Street St. Louisville OH 43071,432 Main Long Road St. Louisville OH 43071,786 High Street Pollocksville NY 56432," ."54 Holy Grail Street Niagara Town ZP 32908,3200 Main Rd. Bern AE 56210,1 Gordon St. Atlanta RE 13000," ."10 Pussy Cat Rd. Chicago EX 34342,10 Gordon St. Atlanta RE 13000,58 Gordon Road Atlanta RE 13000," ."22 Tokyo Av. Tedmondville SW 43098,674 Paris bd. Abbeville AA 45521,10 Surta Alley Goodtown GG 30654," ."45 Holy Grail Al. Niagara Town ZP 32908,320 Main Al. Bern AE 56210,14 Gordon Park Atlanta RE 13000," ."100 Pussy Cat Rd. Chicago EX 34342,2 Gordon St. Atlanta RE 13000,5 Gordon Road Atlanta RE 13000," ."2200 Tokyo Av. Tedmondville SW 43098,67 Paris St. Abbeville AA 45521,11 Surta Avenue Goodtown GG 30654," ."45 Holy Grail Al. Niagara Town ZP 32918,320 Main Al. Bern AE 56215,14 Gordon Park Atlanta RE 13200," ."100 Pussy Cat Rd. Chicago EX 34345,2 Gordon St. Atlanta RE 13222,5 Gordon Road Atlanta RE 13001," ."2200 Tokyo Av. Tedmondville SW 43198,67 Paris St. Abbeville AA 45522,11 Surta Avenue Goodville GG 30655," ."2222 Tokyo Av. Tedmondville SW 43198,670 Paris St. Abbeville AA 45522,114 Surta Avenue Goodville GG 30655," ."2 Holy Grail Street Niagara Town ZP 32908,3 Main Rd. Bern AE 56210,77 Gordon St. Atlanta RE 13000"; function travel($r, $zipcode) { $fullAddress = explode( "," , $r ); $filteredAddress = preg_grep("/".$zipcode."$/" , $fullAddress); $splitAddress = array_reduce( $filteredAddress , function($total, $current) { preg_match_all( "/^[0-9]+ |.*(?=[A-Z]{2} [0-9]{5}$)/" , $current , $matches ); array_push($total['streetNames'], trim($matches[0][1])); array_push($total['streetNos'], trim($matches[0][0])); return $total; } , array("streetNames"=>[],"streetNos"=>[])); return $zipcode .":" .implode(',' , $splitAddress["streetNames"]) ."/" .implode(',' , $splitAddress["streetNos"]); } echo(travel($ad, "NY 5643"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VQab4
function name:  (null)
number of ops:  7
compiled vars:  !0 = $ad
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '123+Main+Street+St.+Louisville+OH+43071%2C432+Main+Long+Road+St.+Louisville+OH+43071%2C786+High+Street+Pollocksville+NY+56432%2C54+Holy+Grail+Street+Niagara+Town+ZP+32908%2C3200+Main+Rd.+Bern+AE+56210%2C1+Gordon+St.+Atlanta+RE+13000%2C10+Pussy+Cat+Rd.+Chicago+EX+34342%2C10+Gordon+St.+Atlanta+RE+13000%2C58+Gordon+Road+Atlanta+RE+13000%2C22+Tokyo+Av.+Tedmondville+SW+43098%2C674+Paris+bd.+Abbeville+AA+45521%2C10+Surta+Alley+Goodtown+GG+30654%2C45+Holy+Grail+Al.+Niagara+Town+ZP+32908%2C320+Main+Al.+Bern+AE+56210%2C14+Gordon+Park+Atlanta+RE+13000%2C100+Pussy+Cat+Rd.+Chicago+EX+34342%2C2+Gordon+St.+Atlanta+RE+13000%2C5+Gordon+Road+Atlanta+RE+13000%2C2200+Tokyo+Av.+Tedmondville+SW+43098%2C67+Paris+St.+Abbeville+AA+45521%2C11+Surta+Avenue+Goodtown+GG+30654%2C45+Holy+Grail+Al.+Niagara+Town+ZP+32918%2C320+Main+Al.+Bern+AE+56215%2C14+Gordon+Park+Atlanta+RE+13200%2C100+Pussy+Cat+Rd.+Chicago+EX+34345%2C2+Gordon+St.+Atlanta+RE+13222%2C5+Gordon+Road+Atlanta+RE+13001%2C2200+Tokyo+Av.+Tedmondville+SW+43198%2C67+Paris+St.+Abbeville+AA+45522%2C11+Surta+Avenue+Goodville+GG+30655%2C2222+Tokyo+Av.+Tedmondville+SW+43198%2C670+Paris+St.+Abbeville+AA+45522%2C114+Surta+Avenue+Goodville+GG+30655%2C2+Holy+Grail+Street+Niagara+Town+ZP+32908%2C3+Main+Rd.+Bern+AE+56210%2C77+Gordon+St.+Atlanta+RE+13000'
   38     1        INIT_FCALL                                               'travel'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'NY+5643'
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
          6      > RETURN                                                   1

Function travel:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VQab4
function name:  travel
number of ops:  37
compiled vars:  !0 = $r, !1 = $zipcode, !2 = $fullAddress, !3 = $filteredAddress, !4 = $splitAddress
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   18     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%2C'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
   20     7        INIT_FCALL                                               'preg_grep'
          8        CONCAT                                           ~7      '%2F', !1
          9        CONCAT                                           ~8      ~7, '%24%2F'
         10        SEND_VAL                                                 ~8
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $9      
         13        ASSIGN                                                   !3, $9
   22    14        INIT_FCALL                                               'array_reduce'
         15        SEND_VAR                                                 !3
   23    16        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FVQab4%3A23%240'
   28    17        SEND_VAL                                                 ~11
   29    18        SEND_VAL                                                 <array>
         19        DO_ICALL                                         $12     
   22    20        ASSIGN                                                   !4, $12
   32    21        CONCAT                                           ~14     !1, '%3A'
   33    22        INIT_FCALL                                               'implode'
         23        SEND_VAL                                                 '%2C'
         24        FETCH_DIM_R                                      ~15     !4, 'streetNames'
         25        SEND_VAL                                                 ~15
         26        DO_ICALL                                         $16     
         27        CONCAT                                           ~17     ~14, $16
   34    28        CONCAT                                           ~18     ~17, '%2F'
   35    29        INIT_FCALL                                               'implode'
         30        SEND_VAL                                                 '%2C'
         31        FETCH_DIM_R                                      ~19     !4, 'streetNos'
         32        SEND_VAL                                                 ~19
         33        DO_ICALL                                         $20     
         34        CONCAT                                           ~21     ~18, $20
         35      > RETURN                                                   ~21
   36    36*     > RETURN                                                   null

End of function travel

Function %00%7Bclosure%7D%2Fin%2FVQab4%3A23%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VQab4
function name:  {closure}
number of ops:  29
compiled vars:  !0 = $total, !1 = $current, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAL                                                 '%2F%5E%5B0-9%5D%2B+%7C.%2A%28%3F%3D%5BA-Z%5D%7B2%7D+%5B0-9%5D%7B5%7D%24%29%2F'
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
   25     7        INIT_FCALL                                               'array_push'
          8        FETCH_DIM_W                                      $4      !0, 'streetNames'
          9        SEND_REF                                                 $4
         10        INIT_FCALL                                               'trim'
         11        FETCH_DIM_R                                      ~5      !2, 0
         12        FETCH_DIM_R                                      ~6      ~5, 1
         13        SEND_VAL                                                 ~6
         14        DO_ICALL                                         $7      
         15        SEND_VAR                                                 $7
         16        DO_ICALL                                                 
   26    17        INIT_FCALL                                               'array_push'
         18        FETCH_DIM_W                                      $9      !0, 'streetNos'
         19        SEND_REF                                                 $9
         20        INIT_FCALL                                               'trim'
         21        FETCH_DIM_R                                      ~10     !2, 0
         22        FETCH_DIM_R                                      ~11     ~10, 0
         23        SEND_VAL                                                 ~11
         24        DO_ICALL                                         $12     
         25        SEND_VAR                                                 $12
         26        DO_ICALL                                                 
   27    27      > RETURN                                                   !0
   28    28*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FVQab4%3A23%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.69 ms | 1398 KiB | 28 Q