3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { private ?string $b = null; public static function newInstance($args){ return new self($args); } public function __construct($b = 'default') { $this->b = $b; } public function test() { echo("Test:" . $this->b . "\n"); } } $a = new A('test'); $a->test(); var_dump(class_exists('\\A')); $b = new ReflectionClass('A'); $c = $b->newInstance(); $c->test(); var_dump(class_exists('\\A'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RgV7B
function name:  (null)
number of ops:  24
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   NEW                                                  $3      'A'
          1        SEND_VAL_EX                                                  'test'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $3
   23     4        INIT_METHOD_CALL                                             !0, 'test'
          5        DO_FCALL                                          0          
   25     6        INIT_FCALL                                                   'var_dump'
          7        FRAMELESS_ICALL_1                class_exists        ~7      '%5CA'
          8        SEND_VAL                                                     ~7
          9        DO_ICALL                                                     
   27    10        NEW                                                  $9      'ReflectionClass'
         11        SEND_VAL_EX                                                  'A'
         12        DO_FCALL                                          0          
         13        ASSIGN                                                       !1, $9
   28    14        INIT_METHOD_CALL                                             !1, 'newInstance'
         15        DO_FCALL                                          0  $12     
         16        ASSIGN                                                       !2, $12
   29    17        INIT_METHOD_CALL                                             !2, 'test'
         18        DO_FCALL                                          0          
   31    19        INIT_FCALL                                                   'var_dump'
         20        FRAMELESS_ICALL_1                class_exists        ~15     '%5CA'
         21        SEND_VAL                                                     ~15
         22        DO_ICALL                                                     
         23      > RETURN                                                       1

Class A:
Function newinstance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RgV7B
function name:  newInstance
number of ops:  6
compiled vars:  !0 = $args
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
    8     1        NEW                              self                $1      
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0          
          4      > RETURN                                                       $1
    9     5*     > RETURN                                                       null

End of function newinstance

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RgV7B
function name:  __construct
number of ops:  4
compiled vars:  !0 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV_INIT                                            !0      'default'
   13     1        ASSIGN_OBJ                                                   'b'
          2        OP_DATA                                                      !0
   14     3      > RETURN                                                       null

End of function __construct

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RgV7B
function name:  test
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   FETCH_OBJ_R                                          ~0      'b'
          1        CONCAT                                               ~1      'Test%3A', ~0
          2        CONCAT                                               ~2      ~1, '%0A'
          3        ECHO                                                         ~2
   19     4      > RETURN                                                       null

End of function test

End of class A.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
192.74 ms | 1488 KiB | 14 Q