3v4l.org

run code in 300+ 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 = 22
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 22
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 21
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/W2SYW
function name:  (null)
number of ops:  29
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, ->22
         12    > > FE_FETCH_R                                       ~18     $17, !6, ->22
         13    >   ASSIGN                                                   !7, ~18
         14        INIT_FCALL                                               'in_array'
         15        SEND_VAR                                                 !7
         16        SEND_VAR                                                 !5
         17        DO_ICALL                                         $20     
         18        BOOL_NOT                                         ~21     $20
         19      > JMPZ                                                     ~21, ->21
         20    >   UNSET_VAR                                                !7
         21    > > JMP                                                      ->12
         22    >   FE_FREE                                                  $17
   10    23        INIT_FCALL                                               'print_r'
         24        INIT_FCALL                                               'get_defined_vars'
         25        DO_ICALL                                         $22     
         26        SEND_VAR                                                 $22
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.27 ms | 1396 KiB | 19 Q