3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = 10; $b = 20; $c = 30; $d = 40; $defined_variables = get_defined_vars(); $defined_variables = get_defined_vars(); $variables2keep = array("a", "b", "c", "variables2keep"); foreach($defined_variables as $variable => $value) if(!in_array($variable, $variables2keep)) unset($$variable); print_r(get_defined_vars());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 18
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/W2SYW
function name:  (null)
number of ops:  26
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $d, !4 = $defined_variables, !5 = $variables2keep, !6 = $value, !7 = $variable
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, 10
    3     1        ASSIGN                                                       !1, 20
    4     2        ASSIGN                                                       !2, 30
    5     3        ASSIGN                                                       !3, 40
    6     4        INIT_FCALL                                                   'get_defined_vars'
          5        DO_ICALL                                             $12     
          6        ASSIGN                                                       !4, $12
    7     7        INIT_FCALL                                                   'get_defined_vars'
          8        DO_ICALL                                             $14     
          9        ASSIGN                                                       !4, $14
    8    10        ASSIGN                                                       !5, <array>
    9    11      > FE_RESET_R                                           $17     !4, ->19
         12    > > FE_FETCH_R                                           ~18     $17, !6, ->19
         13    >   ASSIGN                                                       !7, ~18
         14        FRAMELESS_ICALL_2                in_array            ~20     !7, !5
         15        BOOL_NOT                                             ~21     ~20
         16      > JMPZ                                                         ~21, ->18
         17    >   UNSET_VAR                                                    !7
         18    > > JMP                                                          ->12
         19    >   FE_FREE                                                      $17
   10    20        INIT_FCALL                                                   'print_r'
         21        INIT_FCALL                                                   'get_defined_vars'
         22        DO_ICALL                                             $22     
         23        SEND_VAR                                                     $22
         24        DO_ICALL                                                     
         25      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.82 ms | 4436 KiB | 15 Q