3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface SerializableInterface {}; interface SomeResizableInterface {}; interface IterableInterface {}; trait SomeSerializableTrait {}; trait SomeOtherSerializableTrait {}; class SomeContainer implements SerializableInterface, IterableInterface { use SomeSerializableTrait; } class SomeOtherContainer extends SomeContainer implements SomeResizableInterface { use SomeOtherSerializableTrait; } $someContainer = new SomeContainer; $someOtherContainer = new SomeOtherContainer; var_dump($someContainer instanceof SerializableInterface); var_dump($someOtherContainer instanceof SerializableInterface); var_dump($someOtherContainer instanceof SomeSerializableTrait); // type hint it function testTrait(SomeSerializableTrait $container) {} function testInterface(SomeResizableInterface $container) {} testTrait($someOtherContainer); testInterface($someOtherContainer);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4dN3n
function name:  (null)
number of ops:  27
compiled vars:  !0 = $someContainer, !1 = $someOtherContainer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   DECLARE_CLASS                                            'somecontainer'
   13     1        DECLARE_CLASS                                            'someothercontainer', 'somecontainer'
   17     2        NEW                                              $2      'SomeContainer'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   18     5        NEW                                              $5      'SomeOtherContainer'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   20     8        INIT_FCALL                                               'var_dump'
          9        INSTANCEOF                                       ~8      !0, 'SerializableInterface'
         10        SEND_VAL                                                 ~8
         11        DO_ICALL                                                 
   21    12        INIT_FCALL                                               'var_dump'
         13        INSTANCEOF                                       ~10     !1, 'SerializableInterface'
         14        SEND_VAL                                                 ~10
         15        DO_ICALL                                                 
   23    16        INIT_FCALL                                               'var_dump'
         17        INSTANCEOF                                       ~12     !1, 'SomeSerializableTrait'
         18        SEND_VAL                                                 ~12
         19        DO_ICALL                                                 
   29    20        INIT_FCALL                                               'testtrait'
         21        SEND_VAR                                                 !1
         22        DO_FCALL                                      0          
   30    23        INIT_FCALL                                               'testinterface'
         24        SEND_VAR                                                 !1
         25        DO_FCALL                                      0          
         26      > RETURN                                                   1

Function testtrait:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4dN3n
function name:  testTrait
number of ops:  2
compiled vars:  !0 = $container
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function testtrait

Function testinterface:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4dN3n
function name:  testInterface
number of ops:  2
compiled vars:  !0 = $container
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function testinterface

Class SerializableInterface: [no user functions]
Class SomeResizableInterface: [no user functions]
Class IterableInterface: [no user functions]
Class SomeSerializableTrait: [no user functions]
Class SomeOtherSerializableTrait: [no user functions]
Class SomeContainer: [no user functions]
Class SomeOtherContainer: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.33 ms | 1394 KiB | 17 Q