3v4l.org

run code in 500+ PHP versions simultaneously
<?php class CarCollection {} class CarService { public function getCars(&$collection) { $collection = new CarCollection("foo"); } } $service = new CarService(); $collection = new StdClass; echo get_class($collection) . PHP_EOL; $service->getCars($collection); echo get_class($collection) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KtFvZ
function name:  (null)
number of ops:  16
compiled vars:  !0 = $service, !1 = $collection
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   NEW                                                  $2      'CarService'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   15     3        NEW                                                  $5      'StdClass'
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !1, $5
   16     6        GET_CLASS                                            ~8      !1
          7        CONCAT                                               ~9      ~8, '%0A'
          8        ECHO                                                         ~9
   18     9        INIT_METHOD_CALL                                             !0, 'getCars'
         10        SEND_VAR_EX                                                  !1
         11        DO_FCALL                                          0          
   19    12        GET_CLASS                                            ~11     !1
         13        CONCAT                                               ~12     ~11, '%0A'
         14        ECHO                                                         ~12
         15      > RETURN                                                       1

Class CarCollection: [no user functions]
Class CarService:
Function getcars:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KtFvZ
function name:  getCars
number of ops:  6
compiled vars:  !0 = $collection
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
    9     1        NEW                                                  $1      'CarCollection'
          2        SEND_VAL_EX                                                  'foo'
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !0, $1
   10     5      > RETURN                                                       null

End of function getcars

End of class CarService.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.3 ms | 2539 KiB | 13 Q