3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'tableData' => [ [ 'booking_name' => 'abc/xyz/123', 'pdg' => 'assure', 'user_area' => 'es st', 'release' => 'oss72', 'start_date' => '2017-06-20 00:00:00', 'end_date' => '2017-06-23 00:00:00', 'asset_info' => [ [ 'status' => 10, 'manufacturer' => 'HP', 'model' => 'HP BL460C GEN8', 'hardware_color' => ''#0066b3' ] ], 'full_name' => 'Valay Desai', 'email_address' => 'valay@xyz.com' ], [ 'booking_name' => 'abc/xyz/123', 'pdg' => 'assure', 'user_area' => 'ls reca', 'release' => 'oss72', 'start_date' => '2017-06-20 00:00:00', 'end_date' => '2017-06-23 00:00:00', 'asset_info' => [ [ 'status' => 10, 'manufacturer' => 'SUN', 'model' => 'SUN GEN8', 'hardware_color' => '#0066b3' ] ], 'full_name' => 'Chako Desai', 'email_address' => 'chako@xyz.com' ] ] ]; $filterBy = [ 'booking_name' => 'abc', 'pdg' => [ ['name' => 'Invalid', 'value' => 'Invalid'], ['name' => 'assure', 'value' => 'assure'] ], 'user_area' => [ ['name' => 'es st', 'value' => 'es st'], ['name' => 'Invalid', 'value' => 'Invalid'], ['name' => 'a&o', 'value' => 'a&o'] ] ]; // simplify structure $filterBy['pdg'] = array_column($filterBy['pdg'], 'value'); $filterBy['user_area'] = array_column($filterBy['user_area'], 'value'); var_export( [ 'tableData' => array_filter( $array['tableData'], function($row) use($filterBy) { return str_contains($row['booking_name'], $filterBy['booking_name']) && in_array($row['pdg'], $filterBy['pdg']) && in_array($row['user_area'], $filterBy['user_area']); } ) ] );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4paXE
function name:  (null)
number of ops:  28
compiled vars:  !0 = $array, !1 = $filterBy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   44     1        ASSIGN                                                   !1, <array>
   58     2        INIT_FCALL                                               'array_column'
          3        FETCH_DIM_R                                      ~5      !1, 'pdg'
          4        SEND_VAL                                                 ~5
          5        SEND_VAL                                                 'value'
          6        DO_ICALL                                         $6      
          7        ASSIGN_DIM                                               !1, 'pdg'
          8        OP_DATA                                                  $6
   59     9        INIT_FCALL                                               'array_column'
         10        FETCH_DIM_R                                      ~8      !1, 'user_area'
         11        SEND_VAL                                                 ~8
         12        SEND_VAL                                                 'value'
         13        DO_ICALL                                         $9      
         14        ASSIGN_DIM                                               !1, 'user_area'
         15        OP_DATA                                                  $9
   61    16        INIT_FCALL                                               'var_export'
   64    17        INIT_FCALL                                               'array_filter'
   65    18        FETCH_DIM_R                                      ~10     !0, 'tableData'
         19        SEND_VAL                                                 ~10
   66    20        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F4paXE%3A66%240'
         21        BIND_LEXICAL                                             ~11, !1
   70    22        SEND_VAL                                                 ~11
         23        DO_ICALL                                         $12     
         24        INIT_ARRAY                                       ~13     $12, 'tableData'
         25        SEND_VAL                                                 ~13
         26        DO_ICALL                                                 
   73    27      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F4paXE%3A66%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 46) Position 1 = 17, Position 2 = 24
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 16
filename:       /in/4paXE
function name:  {closure}
number of ops:  26
compiled vars:  !0 = $row, !1 = $filterBy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   66     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   67     2        INIT_FCALL                                               'str_contains'
          3        FETCH_DIM_R                                      ~2      !0, 'booking_name'
          4        SEND_VAL                                                 ~2
          5        FETCH_DIM_R                                      ~3      !1, 'booking_name'
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8      > JMPZ_EX                                          ~5      $4, ->16
   68     9    >   INIT_FCALL                                               'in_array'
         10        FETCH_DIM_R                                      ~6      !0, 'pdg'
         11        SEND_VAL                                                 ~6
         12        FETCH_DIM_R                                      ~7      !1, 'pdg'
         13        SEND_VAL                                                 ~7
         14        DO_ICALL                                         $8      
         15        BOOL                                             ~5      $8
         16    > > JMPZ_EX                                          ~5      ~5, ->24
   69    17    >   INIT_FCALL                                               'in_array'
         18        FETCH_DIM_R                                      ~9      !0, 'user_area'
         19        SEND_VAL                                                 ~9
         20        FETCH_DIM_R                                      ~10     !1, 'user_area'
         21        SEND_VAL                                                 ~10
         22        DO_ICALL                                         $11     
         23        BOOL                                             ~5      $11
         24    > > RETURN                                                   ~5
   70    25*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F4paXE%3A66%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.49 ms | 1404 KiB | 23 Q