3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class Phrase implements \Stringable { public function __construct (private readonly string $phrase) {} public function __toString() { return $this->phrase; } } function testMessagePrint(string|\Stringable $message) { echo $message; } $message1 = 'message1'; $message2 = new Phrase('message2'); testMessagePrint($message1); echo "\n"; testMessagePrint($message2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CQM7s
function name:  (null)
number of ops:  14
compiled vars:  !0 = $message1, !1 = $message2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'phrase'
   15     1        ASSIGN                                                   !0, 'message1'
   16     2        NEW                                              $3      'Phrase'
          3        SEND_VAL_EX                                              'message2'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $3
   18     6        INIT_FCALL                                               'testmessageprint'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0          
   19     9        ECHO                                                     '%0A'
   20    10        INIT_FCALL                                               'testmessageprint'
         11        SEND_VAR                                                 !1
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

Function testmessageprint:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CQM7s
function name:  testMessagePrint
number of ops:  3
compiled vars:  !0 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        ECHO                                                     !0
   13     2      > RETURN                                                   null

End of function testmessageprint

Class Phrase:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CQM7s
function name:  __construct
number of ops:  4
compiled vars:  !0 = $phrase
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'phrase'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function __construct

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

End of function __tostring

End of class Phrase.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.44 ms | 1012 KiB | 15 Q