3v4l.org

run code in 300+ 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 = 9, Position 2 = 11
Branch analysis from position: 9
Return found
Branch analysis from position: 11
filename:       /in/le78R
function name:  set_a
number of ops:  13
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        INIT_FCALL                                               'in_array'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $2      
          7        BOOL_NOT                                         ~3      $2
          8      > JMPZ                                                     ~3, ->11
    8     9    >   ASSIGN_DIM                                               !1
         10        OP_DATA                                                  !0
   10    11    > > RETURN_BY_REF                                            !1
   11    12*     > RETURN_BY_REF                                            null

End of function set_a

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.72 ms | 1403 KiB | 19 Q