3v4l.org

run code in 300+ PHP versions simultaneously
<?php function mod(&$item){ $item["position"] = preg_replace("/[^0-9]+/","",$item["position"]); $item["count"] = 2*$item["count"]; } $items = [ ["position" => "1", "count" => 4], ["position" => "2", "count" => 3], ]; echo "before: \n"; foreach($items as $item){ var_dump($item) . "\n"; } echo "modifying items...\n"; foreach($items as &$itemRef){ mod($itemRef); } echo "after: \n"; foreach($items as $item){ echo "A"; var_dump($item) . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
2 jumps found. (Code = 125) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
2 jumps found. (Code = 126) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 29
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 29
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 18
Branch analysis from position: 10
filename:       /in/EhNQU
function name:  (null)
number of ops:  31
compiled vars:  !0 = $items, !1 = $item, !2 = $itemRef
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, <array>
   14     1        ECHO                                                     'before%3A+%0A'
   15     2      > FE_RESET_R                                       $4      !0, ->10
          3    > > FE_FETCH_R                                               $4, !1, ->10
   16     4    >   INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $5      
          7        CONCAT                                           ~6      $5, '%0A'
          8        FREE                                                     ~6
   15     9      > JMP                                                      ->3
         10    >   FE_FREE                                                  $4
   19    11        ECHO                                                     'modifying+items...%0A'
   20    12      > FE_RESET_RW                                      $7      !0, ->18
         13    > > FE_FETCH_RW                                              $7, !2, ->18
   21    14    >   INIT_FCALL                                               'mod'
         15        SEND_REF                                                 !2
         16        DO_FCALL                                      0          
   20    17      > JMP                                                      ->13
         18    >   FE_FREE                                                  $7
   23    19        ECHO                                                     'after%3A+%0A'
   24    20      > FE_RESET_R                                       $9      !0, ->29
         21    > > FE_FETCH_R                                               $9, !1, ->29
   25    22    >   ECHO                                                     'A'
   26    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                         $10     
         26        CONCAT                                           ~11     $10, '%0A'
         27        FREE                                                     ~11
   24    28      > JMP                                                      ->21
         29    >   FE_FREE                                                  $9
   27    30      > RETURN                                                   1

Function mod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EhNQU
function name:  mod
number of ops:  14
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%5B%5E0-9%5D%2B%2F'
          3        SEND_VAL                                                 ''
          4        FETCH_DIM_R                                      ~2      !0, 'position'
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                         $3      
          7        ASSIGN_DIM                                               !0, 'position'
          8        OP_DATA                                                  $3
    5     9        FETCH_DIM_R                                      ~5      !0, 'count'
         10        MUL                                              ~6      ~5, 2
         11        ASSIGN_DIM                                               !0, 'count'
         12        OP_DATA                                                  ~6
    6    13      > RETURN                                                   null

End of function mod

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.38 ms | 1010 KiB | 16 Q