3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { const ALPHA = 1, BETA = 2, GAMMA = 3; public $a = "apple", $b = "bread", $c = "candy"; function showConstant( $c ){ switch( $c) { case "ALPHA": return self::ALPHA; break; case "BETA" : return self::BETA; break; case "GAMMA": return self::GAMA; break; } } } echo (new Test)->showConstant( "BETA" ) ;         // 2 ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KukBF
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $0      'Test'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'showConstant'
          3        SEND_VAL_EX                                              'BETA'
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
          6        FETCH_CONSTANT                                   ~3      '%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0'
          7        FREE                                                     ~3
   14     8      > RETURN                                                   1

Class Test:
Function showconstant:
Finding entry points
Branch analysis from position: 0
5 jumps found. (Code = 188) Position 1 = 9, Position 2 = 11, Position 3 = 13, Position 4 = 16, Position 5 = 2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 13
Branch analysis from position: 11
Branch analysis from position: 9
filename:       /in/KukBF
function name:  showConstant
number of ops:  17
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1      > SWITCH_STRING                                            !0, [ 'ALPHA':->9, 'BETA':->11, 'GAMMA':->13, ], ->16
    7     2    >   IS_EQUAL                                                 !0, 'ALPHA'
          3      > JMPNZ                                                    ~1, ->9
    8     4    >   IS_EQUAL                                                 !0, 'BETA'
          5      > JMPNZ                                                    ~1, ->11
    9     6    >   IS_EQUAL                                                 !0, 'GAMMA'
          7      > JMPNZ                                                    ~1, ->13
          8    > > JMP                                                      ->16
    7     9    > > RETURN                                                   1
         10*       JMP                                                      ->16
    8    11    > > RETURN                                                   2
         12*       JMP                                                      ->16
    9    13    >   FETCH_CLASS_CONSTANT                             ~2      'GAMA'
         14      > RETURN                                                   ~2
         15*       JMP                                                      ->16
   11    16    > > RETURN                                                   null

End of function showconstant

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.31 ms | 1395 KiB | 13 Q