3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Вендорский неймспейс class ShitClass { public function doShitStuff(string $thing) : string { return 'говно'; } } // Наш неймспейс class MyGoodClass { private ShitClass $shit; public function __construct(ShitClass $shit) { $this->shit = $shit; } public function doCandyStuff(string $thing) : string { $shit = $this->shit->doSHitStuff($thing); $candy = $this->shitToCandy($shit); return $candy; } private function shitToCandy(string $shit) : string { return 'конфетку'; } } $shitObject = new ShitClass; echo 'Я съел ' . $shitObject->doShitStuff('сахар') . PHP_EOL; $goodObject = new MyGoodClass($shitObject); echo 'Я съел ' . $goodObject->doCandyStuff('сахар') . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/otfZI
function name:  (null)
number of ops:  20
compiled vars:  !0 = $shitObject, !1 = $goodObject
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   NEW                                              $2      'ShitClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   36     3        INIT_METHOD_CALL                                         !0, 'doShitStuff'
          4        SEND_VAL_EX                                              '%D1%81%D0%B0%D1%85%D0%B0%D1%80'
          5        DO_FCALL                                      0  $5      
          6        CONCAT                                           ~6      '%D0%AF+%D1%81%D1%8A%D0%B5%D0%BB+', $5
          7        CONCAT                                           ~7      ~6, '%0A'
          8        ECHO                                                     ~7
   38     9        NEW                                              $8      'MyGoodClass'
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !1, $8
   39    13        INIT_METHOD_CALL                                         !1, 'doCandyStuff'
         14        SEND_VAL_EX                                              '%D1%81%D0%B0%D1%85%D0%B0%D1%80'
         15        DO_FCALL                                      0  $11     
         16        CONCAT                                           ~12     '%D0%AF+%D1%81%D1%8A%D0%B5%D0%BB+', $11
         17        CONCAT                                           ~13     ~12, '%0A'
         18        ECHO                                                     ~13
   40    19      > RETURN                                                   1

Class ShitClass:
Function doshitstuff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/otfZI
function name:  doShitStuff
number of ops:  4
compiled vars:  !0 = $thing
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1      > RETURN                                                   '%D0%B3%D0%BE%D0%B2%D0%BD%D0%BE'
    8     2*       VERIFY_RETURN_TYPE                                       
          3*     > RETURN                                                   null

End of function doshitstuff

End of class ShitClass.

Class MyGoodClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/otfZI
function name:  __construct
number of ops:  4
compiled vars:  !0 = $shit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   18     1        ASSIGN_OBJ                                               'shit'
          2        OP_DATA                                                  !0
   19     3      > RETURN                                                   null

End of function __construct

Function docandystuff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/otfZI
function name:  doCandyStuff
number of ops:  14
compiled vars:  !0 = $thing, !1 = $shit, !2 = $candy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        FETCH_OBJ_R                                      ~3      'shit'
          2        INIT_METHOD_CALL                                         ~3, 'doSHitStuff'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
   24     6        INIT_METHOD_CALL                                         'shitToCandy'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0  $6      
          9        ASSIGN                                                   !2, $6
   26    10        VERIFY_RETURN_TYPE                                       !2
         11      > RETURN                                                   !2
   27    12*       VERIFY_RETURN_TYPE                                       
         13*     > RETURN                                                   null

End of function docandystuff

Function shittocandy:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/otfZI
function name:  shitToCandy
number of ops:  4
compiled vars:  !0 = $shit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
   31     1      > RETURN                                                   '%D0%BA%D0%BE%D0%BD%D1%84%D0%B5%D1%82%D0%BA%D1%83'
   32     2*       VERIFY_RETURN_TYPE                                       
          3*     > RETURN                                                   null

End of function shittocandy

End of class MyGoodClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.09 ms | 1000 KiB | 13 Q