3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ "foo" => "no", "foo_contact_firstname" => "Mark", "foo_email" => "mark@gmail.com", "foo_address1" => "91", "foo_address2" => "old road", "foo_bill" => "no", "bar" => "yes", "bar_contact_lastname" => null, "bar_telephone" => null, "bar_email" => null, "bar_address1" => null, "bar_address2" => null, "bar_address3" => null, "bar_address4" => null, "bar_address5" => null, "bar_postcode" => null, "register_contact_firstname" => null, "register_contact_lastname" => null, "register_telephone" => null, "register_email" => null, "register_address1" => null, "register_address2" => null, "register_address3" => null, "register_address4" => null, "register_address5" => null, "register_postcode" => null, ]; $test = array_filter($array, function($key) { return strpos($key, "foo") === 0; }, ARRAY_FILTER_USE_KEY ); var_dump($test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9oVJi
function name:  (null)
number of ops:  12
compiled vars:  !0 = $array, !1 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   33     1        INIT_FCALL                                               'array_filter'
          2        SEND_VAR                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F9oVJi%3A33%240'
   36     4        SEND_VAL                                                 ~3
          5        SEND_VAL                                                 2
          6        DO_ICALL                                         $4      
   33     7        ASSIGN                                                   !1, $4
   39     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F9oVJi%3A33%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9oVJi
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
   34     1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'foo'
          4        DO_ICALL                                         $1      
          5        IS_IDENTICAL                                     ~2      $1, 0
          6      > RETURN                                                   ~2
   36     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F9oVJi%3A33%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.69 ms | 1395 KiB | 19 Q