3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Derp { public function __call($name, $arguments) { // Note: value of $name is case sensitive. echo "Calling object method (from Derp class) '$name' " . implode(', ', $arguments). "\n"; } public static function __callStatic($name, $arguments) { // Note: value of $name is case sensitive. echo "Calling static method (from Derp class) '$name' " . implode(', ', $arguments). "\n"; } } class MethodTest { public function nonStaticFunction() { MethodTest::runTest(); Derp::runTest(); } public function __call($name, $arguments) { // Note: value of $name is case sensitive. echo "Calling object method '$name' " . implode(', ', $arguments). "\n"; } /** 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"; } } $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/UKXU9
function name:  (null)
number of ops:  6
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   NEW                                              $1      'MethodTest'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   45     3        INIT_METHOD_CALL                                         !0, 'nonStaticFunction'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class Derp:
Function __call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UKXU9
function name:  __call
number of ops:  13
compiled vars:  !0 = $name, !1 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        ROPE_INIT                                     3  ~3      'Calling+object+method+%28from+Derp+class%29+%27'
          3        ROPE_ADD                                      1  ~3      ~3, !0
          4        ROPE_END                                      2  ~2      ~3, '%27+'
    8     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
    9    12      > RETURN                                                   null

End of function __call

Function __callstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UKXU9
function name:  __callStatic
number of ops:  13
compiled vars:  !0 = $name, !1 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        ROPE_INIT                                     3  ~3      'Calling+static+method+%28from+Derp+class%29+%27'
          3        ROPE_ADD                                      1  ~3      ~3, !0
          4        ROPE_END                                      2  ~2      ~3, '%27+'
   14     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
   15    12      > RETURN                                                   null

End of function __callstatic

End of class Derp.

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

End of function nonstaticfunction

Function __call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UKXU9
function name:  __call
number of ops:  13
compiled vars:  !0 = $name, !1 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   28     2        ROPE_INIT                                     3  ~3      'Calling+object+method+%27'
          3        ROPE_ADD                                      1  ~3      ~3, !0
          4        ROPE_END                                      2  ~2      ~3, '%27+'
   29     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
   30    12      > RETURN                                                   null

End of function __call

Function __callstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UKXU9
function name:  __callStatic
number of ops:  13
compiled vars:  !0 = $name, !1 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   36     2        ROPE_INIT                                     3  ~3      'Calling+static+method+%27'
          3        ROPE_ADD                                      1  ~3      ~3, !0
          4        ROPE_END                                      2  ~2      ~3, '%27+'
   37     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
   38    12      > RETURN                                                   null

End of function __callstatic

End of class MethodTest.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.6 ms | 1404 KiB | 15 Q