3v4l.org

run code in 300+ PHP versions simultaneously
<?php $A = new class('testi') { private $name; function __construct(string $name) { $this->name = $name; } public function getName() : string { return $this->name; } }; $B = new $A('Matti'); $C = new $A('Pekka'); var_dump($B->getName());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pd4nn
function name:  (null)
number of ops:  21
compiled vars:  !0 = $A, !1 = $B, !2 = $C
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_ANON_CLASS                               <unknown> 
          1        NEW                                              $4      $3
          2        SEND_VAL_EX                                              'testi'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $4
   18     5        FETCH_CLASS                                   0  $7      !0
          6        NEW                                              $8      $7
          7        SEND_VAL_EX                                              'Matti'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $8
   19    10        FETCH_CLASS                                   0  $11     !0
         11        NEW                                              $12     $11
         12        SEND_VAL_EX                                              'Pekka'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !2, $12
   20    15        INIT_FCALL                                               'var_dump'
         16        INIT_METHOD_CALL                                         !1, 'getName'
         17        DO_FCALL                                      0  $15     
         18        SEND_VAR                                                 $15
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

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

End of function __construct

Function getname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pd4nn
function name:  getName
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   14     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getname

End of class class@anonymous.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.09 ms | 1396 KiB | 15 Q