3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = ['a']; function &set_a($value) { static $a = []; if (!in_array($value, $a, TRUE)) { $a[] = $value; } return $a; } $a = &set_a('a'); foreach ($a as &$value) { var_dump($value); set_a('b'); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 6, Position 2 = 14
Branch analysis from position: 6
2 jumps found. (Code = 126) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/le78R
function name:  (null)
number of ops:  16
compiled vars:  !0 = $a, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   13     1        INIT_FCALL                                                   'set_a'
          2        SEND_VAL                                                     'a'
          3        DO_FCALL                                          0  $3      
          4        ASSIGN_REF                                                   !0, $3
   14     5      > FE_RESET_RW                                          $5      !0, ->14
          6    > > FE_FETCH_RW                                                  $5, !1, ->14
   15     7    >   INIT_FCALL                                                   'var_dump'
          8        SEND_VAR                                                     !1
          9        DO_ICALL                                                     
   16    10        INIT_FCALL                                                   'set_a'
         11        SEND_VAL                                                     'b'
         12        DO_FCALL                                          0          
   14    13      > JMP                                                          ->6
         14    >   FE_FREE                                                      $5
   17    15      > RETURN                                                       1

Function set_a:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
Return found
Branch analysis from position: 8
filename:       /in/le78R
function name:  set_a
number of ops:  10
compiled vars:  !0 = $value, !1 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
    6     1        BIND_STATIC                                                  !1
    7     2        FRAMELESS_ICALL_3                in_array            ~2      !0, !1
          3        OP_DATA                                                      <true>
          4        BOOL_NOT                                             ~3      ~2
          5      > JMPZ                                                         ~3, ->8
    8     6    >   ASSIGN_DIM                                                   !1
          7        OP_DATA                                                      !0
   10     8    > > RETURN_BY_REF                                                !1
   11     9*     > RETURN_BY_REF                                                null

End of function set_a

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.3 ms | 2244 KiB | 16 Q