3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ydd_api_prefix = '7-'; $items = ['123', '456', '7-123', '7-432']; $referenced_nids = array_reduce($items, function ($return, $yle_id) use ($ydd_api_prefix) { if (strpos($yle_id, $ydd_api_prefix) === 0) { $return[] = substr($yle_id, strlen($ydd_api_prefix)); } return $return; }, []); var_dump($referenced_nids);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qq0m7
function name:  (null)
number of ops:  14
compiled vars:  !0 = $ydd_api_prefix, !1 = $items, !2 = $referenced_nids
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '7-'
    3     1        ASSIGN                                                   !1, <array>
    4     2        INIT_FCALL                                               'array_reduce'
          3        SEND_VAR                                                 !1
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FQq0m7%3A4%240'
          5        BIND_LEXICAL                                             ~5, !0
    9     6        SEND_VAL                                                 ~5
          7        SEND_VAL                                                 <array>
          8        DO_ICALL                                         $6      
    4     9        ASSIGN                                                   !2, $6
   11    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FQq0m7%3A4%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/Qq0m7
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $return, !1 = $yle_id, !2 = $ydd_api_prefix
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
    5     3        INIT_FCALL                                               'strpos'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $3      
          7        IS_IDENTICAL                                             $3, 0
          8      > JMPZ                                                     ~4, ->16
    6     9    >   INIT_FCALL                                               'substr'
         10        SEND_VAR                                                 !1
         11        STRLEN                                           ~6      !2
         12        SEND_VAL                                                 ~6
         13        DO_ICALL                                         $7      
         14        ASSIGN_DIM                                               !0
         15        OP_DATA                                                  $7
    8    16    > > RETURN                                                   !0
    9    17*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FQq0m7%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.04 ms | 1396 KiB | 21 Q