3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace GetObjectVars81; function assertType($_, $a) { var_dump($a); } enum Suit { case Hearts; case Diamonds; case Clubs; case Spades; } enum SuitBacked: string { case Hearts = 'H'; case Diamonds = 'D'; case Clubs = 'C'; case Spades = 'S'; } function check(Suit $suit, SuitBacked $backed): void { assertType('array{a: int, b: string}', get_object_vars($suit)); assertType('array{a: int, b: string}|array{one: int, three: bool}', get_object_vars($backed)); } check(Suit::Hearts, SuitBacked::Diamonds);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6hV36
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   DECLARE_CLASS                                            'getobjectvars81%5Csuit'
   17     1        DECLARE_CLASS                                            'getobjectvars81%5Csuitbacked'
   32     2        INIT_NS_FCALL_BY_NAME                                    'GetObjectVars81%5Ccheck'
          3        FETCH_CLASS_CONSTANT                             ~0      'GetObjectVars81%5CSuit', 'Hearts'
          4        SEND_VAL_EX                                              ~0
          5        FETCH_CLASS_CONSTANT                             ~1      'GetObjectVars81%5CSuitBacked', 'Diamonds'
          6        SEND_VAL_EX                                              ~1
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function getobjectvars81%5Casserttype:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6hV36
function name:  GetObjectVars81\assertType
number of ops:  6
compiled vars:  !0 = $_, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_NS_FCALL_BY_NAME                                    'GetObjectVars81%5Cvar_dump'
          3        SEND_VAR_EX                                              !1
          4        DO_FCALL                                      0          
    7     5      > RETURN                                                   null

End of function getobjectvars81%5Casserttype

Function getobjectvars81%5Ccheck:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6hV36
function name:  GetObjectVars81\check
number of ops:  17
compiled vars:  !0 = $suit, !1 = $backed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   28     2        INIT_NS_FCALL_BY_NAME                                    'GetObjectVars81%5CassertType'
          3        SEND_VAL_EX                                              'array%7Ba%3A+int%2C+b%3A+string%7D'
          4        INIT_NS_FCALL_BY_NAME                                    'GetObjectVars81%5Cget_object_vars'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $2      
          7        SEND_VAR_NO_REF_EX                                       $2
          8        DO_FCALL                                      0          
   29     9        INIT_NS_FCALL_BY_NAME                                    'GetObjectVars81%5CassertType'
         10        SEND_VAL_EX                                              'array%7Ba%3A+int%2C+b%3A+string%7D%7Carray%7Bone%3A+int%2C+three%3A+bool%7D'
         11        INIT_NS_FCALL_BY_NAME                                    'GetObjectVars81%5Cget_object_vars'
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0  $4      
         14        SEND_VAR_NO_REF_EX                                       $4
         15        DO_FCALL                                      0          
   30    16      > RETURN                                                   null

End of function getobjectvars81%5Ccheck

Class GetObjectVars81\Suit: [no user functions]
Class GetObjectVars81\SuitBacked: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.48 ms | 1010 KiB | 18 Q