3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $i = 0; public function __toString() { $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/hpod3
function name:  (null)
number of ops:  15
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'a'
   11     1        NEW                                              $2      'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   15     4        INIT_ARRAY                                       ~5      100
          5        ADD_ARRAY_ELEMENT                                ~5      !0
          6        ASSIGN                                                   !1, ~5
   17     7        INIT_FCALL                                               'var_dump'
   18     8        INIT_FCALL                                               'array_intersect'
          9        SEND_VAR                                                 !1
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                                 
   19    14      > RETURN                                                   1

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

End of function __tostring

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.96 ms | 1395 KiB | 17 Q