3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Role { public $id; public $name; public function __construct($id, $name) { $this->id = $id; $this->name = $name; } } $arr = []; $arr[] = new Role(1, "test"); $role = new Role(1, "test"); var_dump(in_array($role, $arr));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CcjLK
function name:  (null)
number of ops:  20
compiled vars:  !0 = $arr, !1 = $role
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, <array>
   16     1        NEW                                              $4      'Role'
          2        SEND_VAL_EX                                              1
          3        SEND_VAL_EX                                              'test'
          4        DO_FCALL                                      0          
          5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  $4
   17     7        NEW                                              $6      'Role'
          8        SEND_VAL_EX                                              1
          9        SEND_VAL_EX                                              'test'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !1, $6
   19    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'in_array'
         14        SEND_VAR                                                 !1
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $9      
         17        SEND_VAR                                                 $9
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Class Role:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CcjLK
function name:  __construct
number of ops:  7
compiled vars:  !0 = $id, !1 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        ASSIGN_OBJ                                               'id'
          3        OP_DATA                                                  !0
    9     4        ASSIGN_OBJ                                               'name'
          5        OP_DATA                                                  !1
   10     6      > RETURN                                                   null

End of function __construct

End of class Role.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.75 ms | 1395 KiB | 17 Q