3v4l.org

run code in 300+ PHP versions simultaneously
<?php $categories = array('Movie'); $reviews = array( array('category' => 'Movie'), array('category' => 'Movie'), array('category' => 'Movie'), array('category' => 'Movie'), array('category' => 'Game') ); print_r($reviews); // The issue WAS I'm not use ($categories) here... $filtered = array_filter($reviews, function($review) { return in_array($review['category'], $categories) === NULL; }); print_r($filtered);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mZYTf
function name:  (null)
number of ops:  15
compiled vars:  !0 = $categories, !1 = $reviews, !2 = $filtered
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
   13     2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                                 
   16     5        INIT_FCALL                                               'array_filter'
          6        SEND_VAR                                                 !1
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FmZYTf%3A16%240'
   18     8        SEND_VAL                                                 ~6
          9        DO_ICALL                                         $7      
   16    10        ASSIGN                                                   !2, $7
   20    11        INIT_FCALL                                               'print_r'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FmZYTf%3A16%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mZYTf
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $review, !1 = $categories
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        INIT_FCALL                                               'in_array'
          2        FETCH_DIM_R                                      ~2      !0, 'category'
          3        SEND_VAL                                                 ~2
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $3      
          6        TYPE_CHECK                                    2  ~4      $3
          7      > RETURN                                                   ~4
   18     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FmZYTf%3A16%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.99 ms | 1395 KiB | 19 Q