3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { use MyTrait; public $title = 'toto'; } trait MyTrait { public function coucou() { echo 'coucou'; } } $a = new A(); if ($a instanceof MyTrait) { echo " use MyTrait"; } if ($a instanceof A) { echo " instance of A"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
Branch analysis from position: 7
filename:       /in/PF07O
function name:  (null)
number of ops:  11
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'a'
   18     1        NEW                                              $1      'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   20     4        INSTANCEOF                                               !0, 'MyTrait'
          5      > JMPZ                                                     ~4, ->7
   21     6    >   ECHO                                                     '+use+MyTrait'
   24     7    >   INSTANCEOF                                               !0, 'A'
          8      > JMPZ                                                     ~5, ->10
   25     9    >   ECHO                                                     '+instance+of+A'
   26    10    > > RETURN                                                   1

Class A: [no user functions]
Class MyTrait:
Function coucou:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PF07O
function name:  coucou
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ECHO                                                     'coucou'
   15     1      > RETURN                                                   null

End of function coucou

End of class MyTrait.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.25 ms | 1393 KiB | 13 Q