3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $i = 1; public function __toString() { $this->i++; return "$this->i"; } } $a = new A; var_dump($a); $b = [100, $a]; var_dump( $a, array_intersect($b, $b), $a );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HILJh
function name:  (null)
number of ops:  20
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
   12     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
   14     7        INIT_ARRAY                                       ~6      100
          8        ADD_ARRAY_ELEMENT                                ~6      !0
          9        ASSIGN                                                   !1, ~6
   16    10        INIT_FCALL                                               'var_dump'
   17    11        SEND_VAR                                                 !0
   18    12        INIT_FCALL                                               'array_intersect'
         13        SEND_VAR                                                 !1
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $8      
         16        SEND_VAR                                                 $8
   19    17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
   20    19      > RETURN                                                   1

Class A:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HILJh
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:
153.03 ms | 1395 KiB | 17 Q