3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ArrayFilters { private $array = array(); private $name; public function __construct($array, $name){ $this->array = $array; } public function name_is($arr){ print_r($this->name ); return $arr['name'] == $this->name; } } $array1 = array( "a"=>array( 'name' => 'vasya' ,'second_name' => 'Vasilev' ), "b"=>array( 'name' => 'vasya2' ,'second_name' => 'Vasilev2' ), "c"=>array( 'name' => 'vasya3' ,'second_name' => 'Vasilev3' ), "d"=>array( 'name' => 'vasya4' ,'second_name' => 'Vasilev4' ), "e"=>array( 'name' => 'vasya5' ,'second_name' => 'Vasilev5' ) ); print_r(array_filter($array1, array(new ArrayFilters($array1, 'vasya2'), 'name_is')));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zkfu1
function name:  (null)
number of ops:  15
compiled vars:  !0 = $array1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, <array>
   40     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !0
          4        NEW                                              $2      'ArrayFilters'
          5        SEND_VAR_EX                                              !0
          6        SEND_VAL_EX                                              'vasya2'
          7        DO_FCALL                                      0          
          8        INIT_ARRAY                                       ~4      $2
          9        ADD_ARRAY_ELEMENT                                ~4      'name_is'
         10        SEND_VAL                                                 ~4
         11        DO_ICALL                                         $5      
         12        SEND_VAR                                                 $5
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

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

End of function __construct

Function name_is:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zkfu1
function name:  name_is
number of ops:  10
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'print_r'
          2        FETCH_OBJ_R                                      ~1      'name'
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                                 
   12     5        FETCH_DIM_R                                      ~3      !0, 'name'
          6        FETCH_OBJ_R                                      ~4      'name'
          7        IS_EQUAL                                         ~5      ~3, ~4
          8      > RETURN                                                   ~5
   13     9*     > RETURN                                                   null

End of function name_is

End of class ArrayFilters.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.62 ms | 1388 KiB | 17 Q