3v4l.org

run code in 500+ PHP versions simultaneously
<?php enum MethodConstraint :string { case A = "a"; case B = "b"; case C = "c"; public function getMethod(): string { return $this->value; } public function getMethodSentence($value): string { return match ($value) { MethodConstraint::A => "This is an A char", MethodConstraint::B => "This is a B char", MethodConstraint::C => "This is a C char" }; } public function getCharAndSentence(): string { return $this->getMethod()." ".$this->getMethodSentence($this); } } $aChar = MethodConstraint::A; echo $aChar->getMethod().PHP_EOL; echo $aChar->getMethodSentence(MethodConstraint::B).PHP_EOL; echo $aChar->getCharAndSentence();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AZYG7
function name:  (null)
number of ops:  17
compiled vars:  !0 = $aChar
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                                'methodconstraint'
   27     1        FETCH_CLASS_CONSTANT                                 ~1      'MethodConstraint', 'A'
          2        ASSIGN                                                       !0, ~1
   30     3        INIT_METHOD_CALL                                             !0, 'getMethod'
          4        DO_FCALL                                          0  $3      
          5        CONCAT                                               ~4      $3, '%0A'
          6        ECHO                                                         ~4
   31     7        INIT_METHOD_CALL                                             !0, 'getMethodSentence'
          8        FETCH_CLASS_CONSTANT                                 ~5      'MethodConstraint', 'B'
          9        SEND_VAL_EX                                                  ~5
         10        DO_FCALL                                          0  $6      
         11        CONCAT                                               ~7      $6, '%0A'
         12        ECHO                                                         ~7
   32    13        INIT_METHOD_CALL                                             !0, 'getCharAndSentence'
         14        DO_FCALL                                          0  $8      
         15        ECHO                                                         $8
         16      > RETURN                                                       1

Class MethodConstraint:
Function getmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AZYG7
function name:  getMethod
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   FETCH_OBJ_R                                          ~0      'value'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
   11     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function getmethod

Function getmethodsentence:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 197) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
filename:       /in/AZYG7
function name:  getMethodSentence
number of ops:  22
compiled vars:  !0 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
   15     1        FETCH_CLASS_CONSTANT                                 ~2      'MethodConstraint', 'A'
          2        IS_IDENTICAL                                                 !0, ~2
          3      > JMPNZ                                                        ~1, ->12
   16     4    >   FETCH_CLASS_CONSTANT                                 ~3      'MethodConstraint', 'B'
          5        IS_IDENTICAL                                                 !0, ~3
          6      > JMPNZ                                                        ~1, ->14
   17     7    >   FETCH_CLASS_CONSTANT                                 ~4      'MethodConstraint', 'C'
          8        IS_IDENTICAL                                                 !0, ~4
          9      > JMPNZ                                                        ~1, ->16
         10    > > JMP                                                          ->11
         11    > > MATCH_ERROR                                                  !0
   15    12    >   QM_ASSIGN                                            ~5      'This+is+an+A+char'
         13      > JMP                                                          ->18
   16    14    >   QM_ASSIGN                                            ~5      'This+is+a+B+char'
         15      > JMP                                                          ->18
   17    16    >   QM_ASSIGN                                            ~5      'This+is+a+C+char'
         17      > JMP                                                          ->18
         18    >   VERIFY_RETURN_TYPE                                           ~5
         19      > RETURN                                                       ~5
   19    20*       VERIFY_RETURN_TYPE                                           
         21*     > RETURN                                                       null

End of function getmethodsentence

Function getcharandsentence:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AZYG7
function name:  getCharAndSentence
number of ops:  12
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   INIT_METHOD_CALL                                             'getMethod'
          1        DO_FCALL                                          0  $0      
          2        CONCAT                                               ~1      $0, '+'
          3        INIT_METHOD_CALL                                             'getMethodSentence'
          4        FETCH_THIS                                           $2      
          5        SEND_VAR_EX                                                  $2
          6        DO_FCALL                                          0  $3      
          7        CONCAT                                               ~4      ~1, $3
          8        VERIFY_RETURN_TYPE                                           ~4
          9      > RETURN                                                       ~4
   23    10*       VERIFY_RETURN_TYPE                                           
         11*     > RETURN                                                       null

End of function getcharandsentence

End of class MethodConstraint.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
180.96 ms | 1608 KiB | 13 Q