3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $name; public function __construct($name) { $this->name = $name; } public function __toString() { return "[Foo: $this->name]"; } } $a = new Foo("Lorem"); echo $a, "\n"; $s = $a; $s .= "some string"; echo $s, "\n"; $s = $a; $s .= new Foo("Ipsum"); echo $s, "\n"; $s = "some string"; $s .= $a; echo $s, "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nKAKf
function name:  (null)
number of ops:  23
compiled vars:  !0 = $a, !1 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'foo'
   12     1        NEW                                              $2      'Foo'
          2        SEND_VAL_EX                                              'Lorem'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   13     5        ECHO                                                     !0
          6        ECHO                                                     '%0A'
   15     7        ASSIGN                                                   !1, !0
   16     8        ASSIGN_OP                                     8          !1, 'some+string'
   17     9        ECHO                                                     !1
         10        ECHO                                                     '%0A'
   19    11        ASSIGN                                                   !1, !0
   20    12        NEW                                              $8      'Foo'
         13        SEND_VAL_EX                                              'Ipsum'
         14        DO_FCALL                                      0          
         15        ASSIGN_OP                                     8          !1, $8
   21    16        ECHO                                                     !1
         17        ECHO                                                     '%0A'
   23    18        ASSIGN                                                   !1, 'some+string'
   24    19        ASSIGN_OP                                     8          !1, !0
   25    20        ECHO                                                     !1
         21        ECHO                                                     '%0A'
         22      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nKAKf
function name:  __construct
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
    6     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/nKAKf
function name:  __toString
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ROPE_INIT                                     3  ~2      '%5BFoo%3A+'
          1        FETCH_OBJ_R                                      ~0      'name'
          2        ROPE_ADD                                      1  ~2      ~2, ~0
          3        ROPE_END                                      2  ~1      ~2, '%5D'
          4        VERIFY_RETURN_TYPE                                       ~1
          5      > RETURN                                                   ~1
    9     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function __tostring

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.56 ms | 1399 KiB | 13 Q