3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Printable { public function __toString(); } class MyPrintableClass { public $myNumericProperty; public function __construct() { $this->myNumericProperty = 10; } public function __toString() { return 'My numeric property is ' . $this->myNumericProperty; } } function printSomething(string $printable) { echo $printable; } $printable = new MyPrintableClass(); printSomething((string) $printable); printSomething("a real string"); printSomething((string)1234); printSomething((string)1.2); printSomething((string)true);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UdIis
function name:  (null)
number of ops:  25
compiled vars:  !0 = $printable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'printable'
    7     1        DECLARE_CLASS                                            'myprintableclass'
   23     2        NEW                                              $1      'MyPrintableClass'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   24     5        INIT_FCALL                                               'printsomething'
          6        CAST                                          6  ~4      !0
          7        SEND_VAL                                                 ~4
          8        DO_FCALL                                      0          
   25     9        INIT_FCALL                                               'printsomething'
         10        SEND_VAL                                                 'a+real+string'
         11        DO_FCALL                                      0          
   26    12        INIT_FCALL                                               'printsomething'
         13        CAST                                          6  ~7      1234
         14        SEND_VAL                                                 ~7
         15        DO_FCALL                                      0          
   27    16        INIT_FCALL                                               'printsomething'
         17        CAST                                          6  ~9      1.2
         18        SEND_VAL                                                 ~9
         19        DO_FCALL                                      0          
   28    20        INIT_FCALL                                               'printsomething'
         21        CAST                                          6  ~11     <true>
         22        SEND_VAL                                                 ~11
         23        DO_FCALL                                      0          
         24      > RETURN                                                   1

Function printsomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UdIis
function name:  printSomething
number of ops:  3
compiled vars:  !0 = $printable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        ECHO                                                     !0
   21     2      > RETURN                                                   null

End of function printsomething

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

End of function __tostring

End of class Printable.

Class MyPrintableClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UdIis
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN_OBJ                                               'myNumericProperty'
          1        OP_DATA                                                  10
   12     2      > 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/UdIis
function name:  __toString
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_OBJ_R                                      ~0      'myNumericProperty'
          1        CONCAT                                           ~1      'My+numeric+property+is+', ~0
          2        VERIFY_RETURN_TYPE                                       ~1
          3      > RETURN                                                   ~1
   16     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function __tostring

End of class MyPrintableClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.87 ms | 1394 KiB | 18 Q