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( $new_arr ) ){ $new_arr[] = $obj->prop; return true; } } print_r(array_filter('filter_them', $test));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fM2ie
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_VAL                                                 'filter_them'
         24        SEND_VAR                                                 !4
         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 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fM2ie
function name:  filter_them
number of ops:  12
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        SEND_VAR                                                 !1
          4        DO_ICALL                                         $2      
          5        BOOL_NOT                                         ~3      $2
          6      > JMPZ                                                     ~3, ->11
   23     7    >   FETCH_OBJ_R                                      ~5      !0, 'prop'
          8        ASSIGN_DIM                                               !1
          9        OP_DATA                                                  ~5
   24    10      > RETURN                                                   <true>
   26    11    > > RETURN                                                   null

End of function filter_them

Class MyClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.65 ms | 1400 KiB | 19 Q