3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait SomeTrait { public function __call($method, array $parameters) { // ... return is_callable(['parent', '__call']) ? parent::__call($method, $parameters) : null; } } class GreatParentClass { public function __call($method, array $parameters) { return 'bar'; } } class ParenClassWithoutCall { } class ProxyClass extends GreatParentClass { } class FooClass extends ProxyClass { use SomeTrait; } class BarClass extends GreatParentClass { use SomeTrait; } class BazClass extends ParenClassWithoutCall { use SomeTrait; } class SomeClassWithoutParent { use SomeTrait; } $class = new FooClass(); var_dump($class->foobar()); $class = new BarClass(); var_dump($class->foobar()); $class = new BazClass(); var_dump($class->foobar()); $class = new SomeClassWithoutParent(); var_dump($class->foobar());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R8hI3
function name:  (null)
number of ops:  37
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   DECLARE_CLASS                                            'fooclass', 'proxyclass'
   35     1        DECLARE_CLASS                                            'barclass', 'greatparentclass'
   40     2        DECLARE_CLASS                                            'bazclass', 'parenclasswithoutcall'
   45     3        DECLARE_CLASS                                            'someclasswithoutparent'
   50     4        NEW                                              $1      'FooClass'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $1
   51     7        INIT_FCALL                                               'var_dump'
          8        INIT_METHOD_CALL                                         !0, 'foobar'
          9        DO_FCALL                                      0  $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                                 
   53    12        NEW                                              $6      'BarClass'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !0, $6
   54    15        INIT_FCALL                                               'var_dump'
         16        INIT_METHOD_CALL                                         !0, 'foobar'
         17        DO_FCALL                                      0  $9      
         18        SEND_VAR                                                 $9
         19        DO_ICALL                                                 
   56    20        NEW                                              $11     'BazClass'
         21        DO_FCALL                                      0          
         22        ASSIGN                                                   !0, $11
   57    23        INIT_FCALL                                               'var_dump'
         24        INIT_METHOD_CALL                                         !0, 'foobar'
         25        DO_FCALL                                      0  $14     
         26        SEND_VAR                                                 $14
         27        DO_ICALL                                                 
   59    28        NEW                                              $16     'SomeClassWithoutParent'
         29        DO_FCALL                                      0          
         30        ASSIGN                                                   !0, $16
   60    31        INIT_FCALL                                               'var_dump'
         32        INIT_METHOD_CALL                                         !0, 'foobar'
         33        DO_FCALL                                      0  $19     
         34        SEND_VAR                                                 $19
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Class SomeTrait:
Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R8hI3
function name:  __call
number of ops:  15
compiled vars:  !0 = $method, !1 = $parameters
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        INIT_FCALL                                               'is_callable'
          3        SEND_VAL                                                 <array>
          4        DO_ICALL                                         $2      
          5      > JMPZ                                                     $2, ->12
          6    >   INIT_STATIC_METHOD_CALL                                  '__call'
          7        SEND_VAR_EX                                              !0
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0  $3      
         10        QM_ASSIGN                                        ~4      $3
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~4      null
         13    > > RETURN                                                   ~4
    9    14*     > RETURN                                                   null

End of function __call

End of class SomeTrait.

Class GreatParentClass:
Function __call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R8hI3
function name:  __call
number of ops:  4
compiled vars:  !0 = $method, !1 = $parameters
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2      > RETURN                                                   'bar'
   17     3*     > RETURN                                                   null

End of function __call

End of class GreatParentClass.

Class ParenClassWithoutCall: [no user functions]
Class ProxyClass:
Function __call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R8hI3
function name:  __call
number of ops:  4
compiled vars:  !0 = $method, !1 = $parameters
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2      > RETURN                                                   'bar'
   17     3*     > RETURN                                                   null

End of function __call

End of class ProxyClass.

Class FooClass: [no user functions]
Class BarClass: [no user functions]
Class BazClass: [no user functions]
Class SomeClassWithoutParent: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.16 ms | 1400 KiB | 17 Q