3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $i = 0; public function __toString() { var_dump(__METHOD__); $this->i++; return "$this->i"; } } $a = new 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/TgBo6
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'
   13     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'
          8        INIT_FCALL                                               'array_intersect'
          9        SEND_VAR                                                 !1
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                                 
         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/TgBo6
function name:  __toString
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'A%3A%3A__toString'
          2        DO_ICALL                                                 
    8     3        PRE_INC_OBJ                                              'i'
    9     4        FETCH_OBJ_R                                      ~2      'i'
          5        CAST                                          6  ~3      ~2
          6        VERIFY_RETURN_TYPE                                       ~3
          7      > RETURN                                                   ~3
   10     8*       VERIFY_RETURN_TYPE                                       
          9*     > RETURN                                                   null

End of function __tostring

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.14 ms | 1395 KiB | 17 Q