3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A0 { public function __toString() { return 'a0'; } }; class A1 extends A0 { public function __toString() { return 'a1'; } }; $a = function ($a) : A0 {return $a;}; echo '' . $a((new A0())), '' . $a((new A1()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HrSmh
function name:  (null)
number of ops:  19
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'a0'
    3     1        DECLARE_CLASS                                            'a1', 'a0'
    5     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FHrSmh%3A5%242'
          3        ASSIGN                                                   !0, ~1
    7     4        INIT_DYNAMIC_CALL                                        !0
          5        NEW                                              $3      'A0'
          6        DO_FCALL                                      0          
          7        SEND_VAR_NO_REF_EX                                       $3
          8        DO_FCALL                                      0  $5      
          9        CONCAT                                           ~6      '', $5
         10        ECHO                                                     ~6
         11        INIT_DYNAMIC_CALL                                        !0
         12        NEW                                              $7      'A1'
         13        DO_FCALL                                      0          
         14        SEND_VAR_NO_REF_EX                                       $7
         15        DO_FCALL                                      0  $9      
         16        CONCAT                                           ~10     '', $9
         17        ECHO                                                     ~10
         18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FHrSmh%3A5%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HrSmh
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        VERIFY_RETURN_TYPE                                       !0
          2      > RETURN                                                   !0
          3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FHrSmh%3A5%242

Class A0:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HrSmh
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E > > RETURN                                                   'a0'
          1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function __tostring

End of class A0.

Class A1:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HrSmh
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E > > RETURN                                                   'a1'
          1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function __tostring

End of class A1.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
186.61 ms | 1399 KiB | 13 Q