3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass{ static function getSelf(){ return new self; } function bar(){ echo 'bar'; return $this; } function baz(){ echo 'bazzed.'; } } $o = new MyClass(); echo $o->bar()->baz(); // PHP 5.2 echo MyClass::getSelf()->bar()->baz(); // PHP 5.3 echo (new MyClass)->bar()->baz(); // PHP 5.4
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N2l7Y
function name:  (null)
number of ops:  23
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'MyClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   17     3        INIT_METHOD_CALL                                         !0, 'bar'
          4        DO_FCALL                                      0  $4      
          5        INIT_METHOD_CALL                                         $4, 'baz'
          6        DO_FCALL                                      0  $5      
          7        ECHO                                                     $5
   19     8        INIT_STATIC_METHOD_CALL                                  'MyClass', 'getSelf'
          9        DO_FCALL                                      0  $6      
         10        INIT_METHOD_CALL                                         $6, 'bar'
         11        DO_FCALL                                      0  $7      
         12        INIT_METHOD_CALL                                         $7, 'baz'
         13        DO_FCALL                                      0  $8      
         14        ECHO                                                     $8
   21    15        NEW                                              $9      'MyClass'
         16        DO_FCALL                                      0          
         17        INIT_METHOD_CALL                                         $9, 'bar'
         18        DO_FCALL                                      0  $11     
         19        INIT_METHOD_CALL                                         $11, 'baz'
         20        DO_FCALL                                      0  $12     
         21        ECHO                                                     $12
         22      > RETURN                                                   1

Class MyClass:
Function getself:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N2l7Y
function name:  getSelf
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                          self                $0      
          1        DO_FCALL                                      0          
          2      > RETURN                                                   $0
    6     3*     > RETURN                                                   null

End of function getself

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N2l7Y
function name:  bar
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ECHO                                                     'bar'
    9     1        FETCH_THIS                                       ~0      
          2      > RETURN                                                   ~0
   10     3*     > RETURN                                                   null

End of function bar

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

End of function baz

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.34 ms | 1399 KiB | 13 Q