3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array2 = array( array('customer_id' => '01', 'categories' => '',), array('customer_id' => '02', 'categories' => '',), array('customer_id' => '03', 'categories' => '20,26,18',), array('customer_id' => '04', 'categories' => '45,118',), array('customer_id' => '05', 'categories' => '45,118,201,18,55',), ); $like = 18; $cat = array_column($array2, 'categories'); $match = preg_grep("/\b" . $like . "\b/", $cat); $res = array_intersect_key($array2, $match); Var_dump($res);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tH0n1
function name:  (null)
number of ops:  23
compiled vars:  !0 = $array2, !1 = $like, !2 = $cat, !3 = $match, !4 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1        ASSIGN                                                   !1, 18
   16     2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'categories'
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !2, $7
   17     7        INIT_FCALL                                               'preg_grep'
          8        CONCAT                                           ~9      '%2F%5Cb', !1
          9        CONCAT                                           ~10     ~9, '%5Cb%2F'
         10        SEND_VAL                                                 ~10
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $11     
         13        ASSIGN                                                   !3, $11
   18    14        INIT_FCALL                                               'array_intersect_key'
         15        SEND_VAR                                                 !0
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                         $13     
         18        ASSIGN                                                   !4, $13
   20    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !4
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.08 ms | 1395 KiB | 21 Q