3v4l.org

run code in 300+ PHP versions simultaneously
<?php function profiler($a, $b, $c) { $profilerOn = true; switch (true) { case $a; case $b; case $c; // turn off profiler $profilerOn = false; } return $profilerOn; } echo " Turn profiler off:\n=======\n"; var_dump(profiler(true, true, true)); var_dump(profiler(false, false, true)); var_dump(profiler(true, false, true)); var_dump(profiler(false, true, true)); var_dump(profiler(true, false, false)); var_dump(profiler(false, true, false)); var_dump(profiler(true, true, false)); echo "\n\nLeave profiler on:\n======\n"; var_dump(profiler(false, false, false));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2PUZG
function name:  (null)
number of ops:  67
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ECHO                                                     '+Turn+profiler+off%3A%0A%3D%3D%3D%3D%3D%3D%3D%0A'
   21     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'profiler'
          3        SEND_VAL                                                 <true>
          4        SEND_VAL                                                 <true>
          5        SEND_VAL                                                 <true>
          6        DO_FCALL                                      0  $0      
          7        SEND_VAR                                                 $0
          8        DO_ICALL                                                 
   22     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'profiler'
         11        SEND_VAL                                                 <false>
         12        SEND_VAL                                                 <false>
         13        SEND_VAL                                                 <true>
         14        DO_FCALL                                      0  $2      
         15        SEND_VAR                                                 $2
         16        DO_ICALL                                                 
   23    17        INIT_FCALL                                               'var_dump'
         18        INIT_FCALL                                               'profiler'
         19        SEND_VAL                                                 <true>
         20        SEND_VAL                                                 <false>
         21        SEND_VAL                                                 <true>
         22        DO_FCALL                                      0  $4      
         23        SEND_VAR                                                 $4
         24        DO_ICALL                                                 
   24    25        INIT_FCALL                                               'var_dump'
         26        INIT_FCALL                                               'profiler'
         27        SEND_VAL                                                 <false>
         28        SEND_VAL                                                 <true>
         29        SEND_VAL                                                 <true>
         30        DO_FCALL                                      0  $6      
         31        SEND_VAR                                                 $6
         32        DO_ICALL                                                 
   25    33        INIT_FCALL                                               'var_dump'
         34        INIT_FCALL                                               'profiler'
         35        SEND_VAL                                                 <true>
         36        SEND_VAL                                                 <false>
         37        SEND_VAL                                                 <false>
         38        DO_FCALL                                      0  $8      
         39        SEND_VAR                                                 $8
         40        DO_ICALL                                                 
   26    41        INIT_FCALL                                               'var_dump'
         42        INIT_FCALL                                               'profiler'
         43        SEND_VAL                                                 <false>
         44        SEND_VAL                                                 <true>
         45        SEND_VAL                                                 <false>
         46        DO_FCALL                                      0  $10     
         47        SEND_VAR                                                 $10
         48        DO_ICALL                                                 
   27    49        INIT_FCALL                                               'var_dump'
         50        INIT_FCALL                                               'profiler'
         51        SEND_VAL                                                 <true>
         52        SEND_VAL                                                 <true>
         53        SEND_VAL                                                 <false>
         54        DO_FCALL                                      0  $12     
         55        SEND_VAR                                                 $12
         56        DO_ICALL                                                 
   29    57        ECHO                                                     '%0A%0ALeave+profiler+on%3A%0A%3D%3D%3D%3D%3D%3D%0A'
   30    58        INIT_FCALL                                               'var_dump'
         59        INIT_FCALL                                               'profiler'
         60        SEND_VAL                                                 <false>
         61        SEND_VAL                                                 <false>
         62        SEND_VAL                                                 <false>
         63        DO_FCALL                                      0  $14     
         64        SEND_VAR                                                 $14
         65        DO_ICALL                                                 
         66      > RETURN                                                   1

Function profiler:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
Branch analysis from position: 8
filename:       /in/2PUZG
function name:  profiler
number of ops:  11
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $profilerOn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    5     3        ASSIGN                                                   !3, <true>
    9     4      > JMPNZ                                                    !0, ->8
   10     5    > > JMPNZ                                                    !1, ->8
   11     6    > > JMPNZ                                                    !2, ->8
          7    > > JMP                                                      ->9
   13     8    >   ASSIGN                                                   !3, <false>
   16     9    > > RETURN                                                   !3
   17    10*     > RETURN                                                   null

End of function profiler

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.04 ms | 1403 KiB | 23 Q