3v4l.org

run code in 300+ PHP versions simultaneously
<?php $addresses_array = array( "Staples Center, 555 Test Drive, Los Angeles, CA 98112", "555 Test Drive, Los Angeles, CA 98112", "Los Angeles, CA", "Los Angeles, CA 98112", "Los Angeles" ); foreach ($addresses_array as &$address) { $arr = explode(", ", $address); if(count($arr) >1){ $arr[count($arr)-1] = explode(" ", $arr[count($arr)-1])[0]; $address = implode(", ", array_slice($arr, -2)); } } var_dump($addresses_array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 33
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 33
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 32
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 32
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/uKvke
function name:  (null)
number of ops:  38
compiled vars:  !0 = $addresses_array, !1 = $address, !2 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1      > FE_RESET_RW                                      $4      !0, ->33
          2    > > FE_FETCH_RW                                              $4, !1, ->33
   12     3    >   INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '%2C+'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !2, $5
   13     8        COUNT                                            ~7      !2
          9        IS_SMALLER                                               1, ~7
         10      > JMPZ                                                     ~8, ->32
   14    11    >   COUNT                                            ~9      !2
         12        SUB                                              ~10     ~9, 1
         13        INIT_FCALL                                               'explode'
         14        SEND_VAL                                                 '+'
         15        COUNT                                            ~12     !2
         16        SUB                                              ~13     ~12, 1
         17        FETCH_DIM_R                                      ~14     !2, ~13
         18        SEND_VAL                                                 ~14
         19        DO_ICALL                                         $15     
         20        FETCH_DIM_R                                      ~16     $15, 0
         21        ASSIGN_DIM                                               !2, ~10
         22        OP_DATA                                                  ~16
   15    23        INIT_FCALL                                               'implode'
         24        SEND_VAL                                                 '%2C+'
         25        INIT_FCALL                                               'array_slice'
         26        SEND_VAR                                                 !2
         27        SEND_VAL                                                 -2
         28        DO_ICALL                                         $17     
         29        SEND_VAR                                                 $17
         30        DO_ICALL                                         $18     
         31        ASSIGN                                                   !1, $18
   11    32    > > JMP                                                      ->2
         33    >   FE_FREE                                                  $4
   19    34        INIT_FCALL                                               'var_dump'
         35        SEND_VAR                                                 !0
         36        DO_ICALL                                                 
         37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.8 ms | 1396 KiB | 21 Q