3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { public $prop; } $foo = new MyClass(); $foo->prop = 'test1'; $bar = $foo; $bam = new MyClass(); $bam->prop = 'test2'; $t = new MyClass(); $t->prop = 'test1'; $test = array($foo, $bar, $bam, $t); function filter_them( $obj ) { static $new_arr; if ( ! in_array( $obj->prop, $new_arr ) ){ $new_arr[] = $obj->prop; return true; } } print_r(array_filter($test, 'filter_them'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QZvO5
function name:  (null)
number of ops:  29
compiled vars:  !0 = $foo, !1 = $bar, !2 = $bam, !3 = $t, !4 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $5      'MyClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $5
    8     3        ASSIGN_OBJ                                               !0, 'prop'
          4        OP_DATA                                                  'test1'
   10     5        ASSIGN                                                   !1, !0
   12     6        NEW                                              $10     'MyClass'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $10
   13     9        ASSIGN_OBJ                                               !2, 'prop'
         10        OP_DATA                                                  'test2'
   15    11        NEW                                              $14     'MyClass'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !3, $14
   16    14        ASSIGN_OBJ                                               !3, 'prop'
         15        OP_DATA                                                  'test1'
   18    16        INIT_ARRAY                                       ~18     !0
         17        ADD_ARRAY_ELEMENT                                ~18     !1
         18        ADD_ARRAY_ELEMENT                                ~18     !2
         19        ADD_ARRAY_ELEMENT                                ~18     !3
         20        ASSIGN                                                   !4, ~18
   28    21        INIT_FCALL                                               'print_r'
         22        INIT_FCALL                                               'array_filter'
         23        SEND_VAR                                                 !4
         24        SEND_VAL                                                 'filter_them'
         25        DO_ICALL                                         $20     
         26        SEND_VAR                                                 $20
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Function filter_them:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QZvO5
function name:  filter_them
number of ops:  14
compiled vars:  !0 = $obj, !1 = $new_arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        BIND_STATIC                                              !1
   22     2        INIT_FCALL                                               'in_array'
          3        FETCH_OBJ_R                                      ~2      !0, 'prop'
          4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $3      
          7        BOOL_NOT                                         ~4      $3
          8      > JMPZ                                                     ~4, ->13
   23     9    >   FETCH_OBJ_R                                      ~6      !0, 'prop'
         10        ASSIGN_DIM                                               !1
         11        OP_DATA                                                  ~6
   24    12      > RETURN                                                   <true>
   26    13    > > RETURN                                                   null

End of function filter_them

Class MyClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.93 ms | 1400 KiB | 19 Q