3v4l.org

run code in 500+ PHP versions simultaneously
<?php class SomeClass { private $message = 'object message'; public static function someStaticMethod() { echo 'static call', PHP_EOL; } public function someObjectMethod() { echo 'object call', PHP_EOL; } public function getMessage() { echo $this->message, PHP_EOL; } private function test() { echo 'test'; } } $staticCallStaticMethod = array('SomeClass', 'someStaticMethod'); $staticCallObjectMethod = array('SomeClass', 'someObjectMethod'); $staticCallGetMessage = array('SomeClass', 'getMessage'); printf("SomeClass::someStaticMethod %s callable\n", is_callable($staticCallStaticMethod) ? "is" : "is not"); printf("SomeClass::someObjectMethod %s callable\n", is_callable($staticCallObjectMethod) ? "is" : "is not"); printf("SomeClass::getMessage %s callable\n", is_callable($staticCallGetMessage) ? "is" : "is not"); $object = new SomeClass(); $objectCallStaticMethod = array($object, 'someStaticMethod'); $objectCallObjectMethod = array($object, 'someObjectMethod'); $objectCallGetMessage = array($object, 'getMessage'); printf("\$object->someStaticMethod %s callable\n", is_callable($objectCallStaticMethod) ? "is" : "is not"); printf("\$object->someObjectMethod %s callable\n", is_callable($objectCallObjectMethod) ? "is" : "is not"); printf("\$object->getMessage %s callable\n", is_callable($objectCallGetMessage) ? "is" : "is not"); echo "Calling SomeClass::someObjectMethod:\n"; call_user_func($staticCallObjectMethod); echo "Calling \$object->someStaticMethod:\n"; call_user_func($objectCallStaticMethod); echo "Calling SomeClass::getMessage:\n"; call_user_func($staticCallGetMessage);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 56
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 67
Branch analysis from position: 65
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
2 jumps found. (Code = 43) Position 1 = 76, Position 2 = 78
Branch analysis from position: 76
1 jumps found. (Code = 42) Position 1 = 79
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 78
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 67
2 jumps found. (Code = 43) Position 1 = 76, Position 2 = 78
Branch analysis from position: 76
Branch analysis from position: 78
Branch analysis from position: 56
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 67
Branch analysis from position: 65
Branch analysis from position: 67
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 56
Branch analysis from position: 54
Branch analysis from position: 56
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
Branch analysis from position: 33
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
Branch analysis from position: 22
filename:       /in/2P3dd
function name:  (null)
number of ops:  91
compiled vars:  !0 = $staticCallStaticMethod, !1 = $staticCallObjectMethod, !2 = $staticCallGetMessage, !3 = $object, !4 = $objectCallStaticMethod, !5 = $objectCallObjectMethod, !6 = $objectCallGetMessage
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E >   ASSIGN                                                       !0, <array>
   29     1        ASSIGN                                                       !1, <array>
   30     2        ASSIGN                                                       !2, <array>
   32     3        INIT_FCALL                                                   'printf'
          4        SEND_VAL                                                     'SomeClass%3A%3AsomeStaticMethod+%25s+callable%0A'
          5        INIT_FCALL                                                   'is_callable'
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                             $10     
          8      > JMPZ                                                         $10, ->11
          9    >   QM_ASSIGN                                            ~11     'is'
         10      > JMP                                                          ->12
         11    >   QM_ASSIGN                                            ~11     'is+not'
         12    >   SEND_VAL                                                     ~11
         13        DO_ICALL                                                     
   33    14        INIT_FCALL                                                   'printf'
         15        SEND_VAL                                                     'SomeClass%3A%3AsomeObjectMethod+%25s+callable%0A'
         16        INIT_FCALL                                                   'is_callable'
         17        SEND_VAR                                                     !1
         18        DO_ICALL                                             $13     
         19      > JMPZ                                                         $13, ->22
         20    >   QM_ASSIGN                                            ~14     'is'
         21      > JMP                                                          ->23
         22    >   QM_ASSIGN                                            ~14     'is+not'
         23    >   SEND_VAL                                                     ~14
         24        DO_ICALL                                                     
   34    25        INIT_FCALL                                                   'printf'
         26        SEND_VAL                                                     'SomeClass%3A%3AgetMessage+%25s+callable%0A'
         27        INIT_FCALL                                                   'is_callable'
         28        SEND_VAR                                                     !2
         29        DO_ICALL                                             $16     
         30      > JMPZ                                                         $16, ->33
         31    >   QM_ASSIGN                                            ~17     'is'
         32      > JMP                                                          ->34
         33    >   QM_ASSIGN                                            ~17     'is+not'
         34    >   SEND_VAL                                                     ~17
         35        DO_ICALL                                                     
   36    36        NEW                                                  $19     'SomeClass'
         37        DO_FCALL                                          0          
         38        ASSIGN                                                       !3, $19
   37    39        INIT_ARRAY                                           ~22     !3
         40        ADD_ARRAY_ELEMENT                                    ~22     'someStaticMethod'
         41        ASSIGN                                                       !4, ~22
   38    42        INIT_ARRAY                                           ~24     !3
         43        ADD_ARRAY_ELEMENT                                    ~24     'someObjectMethod'
         44        ASSIGN                                                       !5, ~24
   39    45        INIT_ARRAY                                           ~26     !3
         46        ADD_ARRAY_ELEMENT                                    ~26     'getMessage'
         47        ASSIGN                                                       !6, ~26
   41    48        INIT_FCALL                                                   'printf'
         49        SEND_VAL                                                     '%24object-%3EsomeStaticMethod+%25s+callable%0A'
         50        INIT_FCALL                                                   'is_callable'
         51        SEND_VAR                                                     !4
         52        DO_ICALL                                             $28     
         53      > JMPZ                                                         $28, ->56
         54    >   QM_ASSIGN                                            ~29     'is'
         55      > JMP                                                          ->57
         56    >   QM_ASSIGN                                            ~29     'is+not'
         57    >   SEND_VAL                                                     ~29
         58        DO_ICALL                                                     
   42    59        INIT_FCALL                                                   'printf'
         60        SEND_VAL                                                     '%24object-%3EsomeObjectMethod+%25s+callable%0A'
         61        INIT_FCALL                                                   'is_callable'
         62        SEND_VAR                                                     !5
         63        DO_ICALL                                             $31     
         64      > JMPZ                                                         $31, ->67
         65    >   QM_ASSIGN                                            ~32     'is'
         66      > JMP                                                          ->68
         67    >   QM_ASSIGN                                            ~32     'is+not'
         68    >   SEND_VAL                                                     ~32
         69        DO_ICALL                                                     
   43    70        INIT_FCALL                                                   'printf'
         71        SEND_VAL                                                     '%24object-%3EgetMessage+%25s+callable%0A'
         72        INIT_FCALL                                                   'is_callable'
         73        SEND_VAR                                                     !6
         74        DO_ICALL                                             $34     
         75      > JMPZ                                                         $34, ->78
         76    >   QM_ASSIGN                                            ~35     'is'
         77      > JMP                                                          ->79
         78    >   QM_ASSIGN                                            ~35     'is+not'
         79    >   SEND_VAL                                                     ~35
         80        DO_ICALL                                                     
   45    81        ECHO                                                         'Calling+SomeClass%3A%3AsomeObjectMethod%3A%0A'
   46    82        INIT_USER_CALL                                    0          'call_user_func', !1
         83        DO_FCALL                                          0          
   48    84        ECHO                                                         'Calling+%24object-%3EsomeStaticMethod%3A%0A'
   49    85        INIT_USER_CALL                                    0          'call_user_func', !4
         86        DO_FCALL                                          0          
   51    87        ECHO                                                         'Calling+SomeClass%3A%3AgetMessage%3A%0A'
   52    88        INIT_USER_CALL                                    0          'call_user_func', !2
         89        DO_FCALL                                          0          
         90      > RETURN                                                       1

Class SomeClass:
Function somestaticmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2P3dd
function name:  someStaticMethod
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                         'static+call'
          1        ECHO                                                         '%0A'
   10     2      > RETURN                                                       null

End of function somestaticmethod

Function someobjectmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2P3dd
function name:  someObjectMethod
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   ECHO                                                         'object+call'
          1        ECHO                                                         '%0A'
   15     2      > RETURN                                                       null

End of function someobjectmethod

Function getmessage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2P3dd
function name:  getMessage
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                          ~0      'message'
          1        ECHO                                                         ~0
          2        ECHO                                                         '%0A'
   20     3      > RETURN                                                       null

End of function getmessage

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2P3dd
function name:  test
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   24     0  E >   ECHO                                                         'test'
   25     1      > RETURN                                                       null

End of function test

End of class SomeClass.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
124.66 ms | 492 KiB | 9 Q