3v4l.org

run code in 300+ PHP versions simultaneously
<?php function unset_globals($array) { if(!is_array($array)) { return; } foreach(array_keys($array) as $key) { unset($GLOBALS[$key]); unset($GLOBALS[$key]); // Double unset to circumvent the zend_hash_del_key_or_index hole in PHP <4.4.3 and <5.1.4 } } $ryat = 'haha'; var_dump($GLOBALS); //$_GET['GLOBALS'] = 'hi'; $_GET['ryat'] = 'hi'; unset_globals($_GET); var_dump($GLOBALS); echo $ryat;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mu5Kb
function name:  (null)
number of ops:  18
compiled vars:  !0 = $ryat
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, 'haha'
   16     1        INIT_FCALL                                               'var_dump'
          2        FETCH_R                      global              ~2      'GLOBALS'
          3        SEND_VAL                                                 ~2
          4        DO_ICALL                                                 
   18     5        FETCH_W                      global              $4      '_GET'
          6        ASSIGN_DIM                                               $4, 'ryat'
          7        OP_DATA                                                  'hi'
   19     8        INIT_FCALL                                               'unset_globals'
          9        FETCH_R                      global              ~6      '_GET'
         10        SEND_VAL                                                 ~6
         11        DO_FCALL                                      0          
   20    12        INIT_FCALL                                               'var_dump'
         13        FETCH_R                      global              ~8      'GLOBALS'
         14        SEND_VAL                                                 ~8
         15        DO_ICALL                                                 
   21    16        ECHO                                                     !0
         17      > RETURN                                                   1

Function unset_globals:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/mu5Kb
function name:  unset_globals
number of ops:  17
compiled vars:  !0 = $array, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        TYPE_CHECK                                  128  ~2      !0
          2        BOOL_NOT                                         ~3      ~2
          3      > JMPZ                                                     ~3, ->5
    6     4    > > RETURN                                                   null
    9     5    >   INIT_FCALL                                               'array_keys'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8      > FE_RESET_R                                       $5      $4, ->15
          9    > > FE_FETCH_R                                               $5, !1, ->15
   11    10    >   FETCH_UNSET                                      $6      'GLOBALS'
         11        UNSET_DIM                                                $6, !1
   12    12        FETCH_UNSET                                      $7      'GLOBALS'
         13        UNSET_DIM                                                $7, !1
    9    14      > JMP                                                      ->9
         15    >   FE_FREE                                                  $5
   14    16      > RETURN                                                   null

End of function unset_globals

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.29 ms | 1394 KiB | 18 Q