3v4l.org

run code in 300+ PHP versions simultaneously
<?php $starts_with = 'bk-'; $facets = [ ['name' => 'bk-0001'], ['name' => 'bk-0002'], ['name' => 'bx-0001'] ]; $new_facets = array_filter($facets, function ($var) use ($starts_with) { return substr($var['name'], 0, strlen($starts_with)) === $starts_with; }); print_r($new_facets);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G0bHI
function name:  (null)
number of ops:  13
compiled vars:  !0 = $starts_with, !1 = $facets, !2 = $new_facets
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'bk-'
    4     1        ASSIGN                                                   !1, <array>
   10     2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !1
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FG0bHI%3A10%240'
          5        BIND_LEXICAL                                             ~5, !0
   12     6        SEND_VAL                                                 ~5
          7        DO_ICALL                                         $6      
   10     8        ASSIGN                                                   !2, $6
   14     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FG0bHI%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G0bHI
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $var, !1 = $starts_with
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   11     2        INIT_FCALL                                               'substr'
          3        FETCH_DIM_R                                      ~2      !0, 'name'
          4        SEND_VAL                                                 ~2
          5        SEND_VAL                                                 0
          6        STRLEN                                           ~3      !1
          7        SEND_VAL                                                 ~3
          8        DO_ICALL                                         $4      
          9        IS_IDENTICAL                                     ~5      !1, $4
         10      > RETURN                                                   ~5
   12    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FG0bHI%3A10%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.56 ms | 1395 KiB | 19 Q