3v4l.org

run code in 300+ PHP versions simultaneously
<?php function profiler($a, $b, $c) { $profiler = true; switch (true) { case $a; case $b; case $c; $profiler = false; } return $profiler; } // last true echo "True:\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)); // last not true echo "\n\nNot true:\n======\n"; var_dump(profiler(false, false, false)); var_dump(profiler(true, false, false)); var_dump(profiler(false, true, false)); var_dump(profiler(true, true, false));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gk4f1
function name:  (null)
number of ops:  67
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ECHO                                                     'True%3A%0A%3D%3D%3D%3D%3D%3D%3D%0A'
   20     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                                                 
   21     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                                                 
   22    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                                                 
   23    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                                                 
   27    33        ECHO                                                     '%0A%0ANot+true%3A%0A%3D%3D%3D%3D%3D%3D%0A'
   28    34        INIT_FCALL                                               'var_dump'
         35        INIT_FCALL                                               'profiler'
         36        SEND_VAL                                                 <false>
         37        SEND_VAL                                                 <false>
         38        SEND_VAL                                                 <false>
         39        DO_FCALL                                      0  $8      
         40        SEND_VAR                                                 $8
         41        DO_ICALL                                                 
   29    42        INIT_FCALL                                               'var_dump'
         43        INIT_FCALL                                               'profiler'
         44        SEND_VAL                                                 <true>
         45        SEND_VAL                                                 <false>
         46        SEND_VAL                                                 <false>
         47        DO_FCALL                                      0  $10     
         48        SEND_VAR                                                 $10
         49        DO_ICALL                                                 
   30    50        INIT_FCALL                                               'var_dump'
         51        INIT_FCALL                                               'profiler'
         52        SEND_VAL                                                 <false>
         53        SEND_VAL                                                 <true>
         54        SEND_VAL                                                 <false>
         55        DO_FCALL                                      0  $12     
         56        SEND_VAR                                                 $12
         57        DO_ICALL                                                 
   31    58        INIT_FCALL                                               'var_dump'
         59        INIT_FCALL                                               'profiler'
         60        SEND_VAL                                                 <true>
         61        SEND_VAL                                                 <true>
         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/Gk4f1
function name:  profiler
number of ops:  11
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $profiler
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
   12     8    >   ASSIGN                                                   !3, <false>
   15     9    > > RETURN                                                   !3
   16    10*     > RETURN                                                   null

End of function profiler

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.2 ms | 1403 KiB | 23 Q