3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getAndUnset(array &$array, $key){ $val = $array[$key]; unset($array[$key]); return $val;} $x = [ 'name'=> 'Del', 'age' => 39, 'sex' => 'yes please', 'location' => 'Leuven', ]; $age = getAndUnset($x, 'age'); var_dump($age); var_dump($x);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bq5f5
function name:  (null)
number of ops:  13
compiled vars:  !0 = $x, !1 = $age
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
   12     1        INIT_FCALL                                               'getandunset'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'age'
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !1, $3
   14     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
   15     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function getandunset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bq5f5
function name:  getAndUnset
number of ops:  7
compiled vars:  !0 = $array, !1 = $key, !2 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        FETCH_DIM_R                                      ~3      !0, !1
          3        ASSIGN                                                   !2, ~3
          4        UNSET_DIM                                                !0, !1
          5      > RETURN                                                   !2
          6*     > RETURN                                                   null

End of function getandunset

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.73 ms | 1401 KiB | 16 Q