3v4l.org

run code in 300+ PHP versions simultaneously
<?php class H { static public function ensure(&$a, $k, $v){ if (!array_key_exists($k, $a)) $a[$k] = $v; } } $array = array(); H::ensure($array, 'foo', 'bar'); var_dump($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y8gih
function name:  (null)
number of ops:  10
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, <array>
    8     1        INIT_STATIC_METHOD_CALL                                  'H', 'ensure'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'foo'
          4        SEND_VAL                                                 'bar'
          5        DO_FCALL                                      0          
    9     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Class H:
Function ensure:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/Y8gih
function name:  ensure
number of ops:  9
compiled vars:  !0 = $a, !1 = $k, !2 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        ARRAY_KEY_EXISTS                                 ~3      !1, !0
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->8
          6    >   ASSIGN_DIM                                               !0, !1
          7        OP_DATA                                                  !2
          8    > > RETURN                                                   null

End of function ensure

End of class H.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.18 ms | 1395 KiB | 15 Q