3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); $incomingArray = [ 'foo' => 'abc', 'bar' => null, 'candy' => 1, 'foobar' => true, 'df' => 'this should not be in results', 'aa' => '', ]; $myKeyCheck = ['foo', 'bar', 'candy', 'foobar', 'barfoo', 'fd', 'aa']; $filter = function($a) { return is_string($a); }; \var_dump(\array_filter(\array_intersect_key($incomingArray, \array_flip($myKeyCheck)), $filter));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/04jV8
function name:  (null)
number of ops:  19
compiled vars:  !0 = $incomingArray, !1 = $myKeyCheck, !2 = $filter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, <array>
   15     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F04jV8%3A15%240'
          3        ASSIGN                                                   !2, ~5
   19     4        INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'array_filter'
          6        INIT_FCALL                                               'array_intersect_key'
          7        SEND_VAR                                                 !0
          8        INIT_FCALL                                               'array_flip'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $7      
         11        SEND_VAR                                                 $7
         12        DO_ICALL                                         $8      
         13        SEND_VAR                                                 $8
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $9      
         16        SEND_VAR                                                 $9
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F04jV8%3A15%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/04jV8
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        TYPE_CHECK                                   64  ~1      !0
          2      > RETURN                                                   ~1
   17     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F04jV8%3A15%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.55 ms | 1395 KiB | 21 Q