3v4l.org

run code in 500+ 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                              ~5      [0]
          5        BIND_LEXICAL                                                 ~5, !0
   12     6        SEND_VAL                                                     ~5
   10     7        DO_ICALL                                             $6      
          8        ASSIGN                                                       !2, $6
   14     9        INIT_FCALL                                                   'print_r'
         10        SEND_VAR                                                     !2
         11        DO_ICALL                                                     
         12      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G0bHI
function name:  {closure:/in/G0bHI:10}
number of ops:  9
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        FETCH_DIM_R                                          ~2      !0, 'name'
          3        STRLEN                                               ~3      !1
          4        FRAMELESS_ICALL_3                substr              ~4      ~2, 0
          5        OP_DATA                                                      ~3
          6        IS_IDENTICAL                                         ~5      !1, ~4
          7      > RETURN                                                       ~5
   12     8*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.84 ms | 2135 KiB | 15 Q