3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $i = 0; public function __toString() { echo "i => {$this->i}\n"; $this->i++; return "$this->i"; } } $a = new A; echo $a; $b = ['100', $a]; var_dump(array_intersect($b, $b));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j2VNR
function name:  (null)
number of ops:  16
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'a'
   13     1        NEW                                              $2      'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   14     4        ECHO                                                     !0
   15     5        INIT_ARRAY                                       ~5      '100'
          6        ADD_ARRAY_ELEMENT                                ~5      !0
          7        ASSIGN                                                   !1, ~5
   17     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'array_intersect'
         10        SEND_VAR                                                 !1
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $7      
         13        SEND_VAR                                                 $7
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Class A:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j2VNR
function name:  __toString
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ROPE_INIT                                     3  ~2      'i+%3D%3E+'
          1        FETCH_OBJ_R                                      ~0      'i'
          2        ROPE_ADD                                      1  ~2      ~2, ~0
          3        ROPE_END                                      2  ~1      ~2, '%0A'
          4        ECHO                                                     ~1
    8     5        PRE_INC_OBJ                                              'i'
    9     6        FETCH_OBJ_R                                      ~5      'i'
          7        CAST                                          6  ~6      ~5
          8        VERIFY_RETURN_TYPE                                       ~6
          9      > RETURN                                                   ~6
   10    10*       VERIFY_RETURN_TYPE                                       
         11*     > RETURN                                                   null

End of function __tostring

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.89 ms | 1388 KiB | 17 Q