3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MethodTest { public function nonStaticFunction() { MethodTest::runTest(); } public function __call($name, $arguments) { // Note: value of $name is case sensitive. echo "Calling object method '$name' " . implode(', ', $arguments). "\n"; if (isset($this)) { echo 'this exists...' .PHP_EOL; } } /** As of PHP 5.3.0 */ public static function __callStatic($name, $arguments) { // Note: value of $name is case sensitive. echo "Calling static method '$name' " . implode(', ', $arguments). "\n"; if (isset($this)) { echo 'this exists...' .PHP_EOL; } } } $obj = new MethodTest; $obj->runTest('in object context'); MethodTest::runTest('in static context'); $obj->nonStaticFunction();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kJtNp
function name:  (null)
number of ops:  12
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   NEW                                              $1      'MethodTest'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   33     3        INIT_METHOD_CALL                                         !0, 'runTest'
          4        SEND_VAL_EX                                              'in+object+context'
          5        DO_FCALL                                      0          
   34     6        INIT_STATIC_METHOD_CALL                                  'MethodTest', 'runTest'
          7        SEND_VAL_EX                                              'in+static+context'
          8        DO_FCALL                                      0          
   35     9        INIT_METHOD_CALL                                         !0, 'nonStaticFunction'
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Class MethodTest:
Function nonstaticfunction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kJtNp
function name:  nonStaticFunction
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_STATIC_METHOD_CALL                                  'MethodTest', 'runTest'
          1        DO_FCALL                                      0          
    7     2      > RETURN                                                   null

End of function nonstaticfunction

Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/kJtNp
function name:  __call
number of ops:  16
compiled vars:  !0 = $name, !1 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        ROPE_INIT                                     3  ~3      'Calling+object+method+%27'
          3        ROPE_ADD                                      1  ~3      ~3, !0
          4        ROPE_END                                      2  ~2      ~3, '%27+'
   12     5        INIT_FCALL                                               'implode'
          6        SEND_VAL                                                 '%2C+'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $5      
          9        CONCAT                                           ~6      ~2, $5
         10        CONCAT                                           ~7      ~6, '%0A'
         11        ECHO                                                     ~7
   14    12        ISSET_ISEMPTY_THIS                               ~8      
         13      > JMPZ                                                     ~8, ->15
   15    14    >   ECHO                                                     'this+exists...%0A'
   17    15    > > RETURN                                                   null

End of function __call

Function __callstatic:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/kJtNp
function name:  __callStatic
number of ops:  16
compiled vars:  !0 = $name, !1 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   23     2        ROPE_INIT                                     3  ~3      'Calling+static+method+%27'
          3        ROPE_ADD                                      1  ~3      ~3, !0
          4        ROPE_END                                      2  ~2      ~3, '%27+'
   24     5        INIT_FCALL                                               'implode'
          6        SEND_VAL                                                 '%2C+'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $5      
          9        CONCAT                                           ~6      ~2, $5
         10        CONCAT                                           ~7      ~6, '%0A'
         11        ECHO                                                     ~7
   26    12        ISSET_ISEMPTY_THIS                               ~8      
         13      > JMPZ                                                     ~8, ->15
   27    14    >   ECHO                                                     'this+exists...%0A'
   29    15    > > RETURN                                                   null

End of function __callstatic

End of class MethodTest.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.63 ms | 1405 KiB | 15 Q