3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); interface Foo { /** * @return string|object The violation message as a string or a stringable object */ function getMessage(); } class SomeMessage implements Foo { /** * {@inheritDoc} */ public function getMessage() { return new class { public function __toString(): string { return 'Hello World'; } }; } }; (static function (string $message): void { echo $message; })((new SomeMessage())->getMessage());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hTYEZ
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                            'somemessage'
   24     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FhTYEZ%3A24%242'
   26     2        INIT_DYNAMIC_CALL                                        ~0
          3        NEW                                              $1      'SomeMessage'
          4        DO_FCALL                                      0          
          5        INIT_METHOD_CALL                                         $1, 'getMessage'
          6        DO_FCALL                                      0  $3      
          7        SEND_VAR_NO_REF_EX                                       $3
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FhTYEZ%3A24%242

Class Foo:
Function getmessage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hTYEZ
function name:  getMessage
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E > > RETURN                                                   null

End of function getmessage

End of class Foo.

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

End of function __tostring

End of class class@anonymous.

Class SomeMessage:
Function getmessage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hTYEZ
function name:  getMessage
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   DECLARE_ANON_CLASS                               <unknown> 
          1        NEW                                              $1      $0
          2        DO_FCALL                                      0          
          3      > RETURN                                                   $1
   21     4*     > RETURN                                                   null

End of function getmessage

End of class SomeMessage.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.76 ms | 1395 KiB | 13 Q