3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @template T of int|numeric-string */ class Foo { /** @param T $bar */ public function __construct(public $bar) {} } function bar(Foo $foo): void { $foo->bar = 123; } /** @var Foo<numeric-string> $foo */ $foo = new Foo("123"); bar($foo); assert(is_string($foo->bar));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TD3a6
function name:  (null)
number of ops:  15
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'Foo'
          1        SEND_VAL_EX                                              '123'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   20     4        INIT_FCALL                                               'bar'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0          
   21     7        ASSERT_CHECK                                             
          8        INIT_FCALL                                               'assert'
          9        FETCH_OBJ_R                                      ~5      !0, 'bar'
         10        TYPE_CHECK                                   64  ~6      ~5
         11        SEND_VAL                                                 ~6
         12        SEND_VAL                                                 'assert%28is_string%28%24foo-%3Ebar%29%29'
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TD3a6
function name:  bar
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        ASSIGN_OBJ                                               !0, 'bar'
          2        OP_DATA                                                  123
   15     3      > RETURN                                                   null

End of function bar

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

End of function __construct

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.01 ms | 1440 KiB | 15 Q