3v4l.org

run code in 300+ PHP versions simultaneously
<?php function flat_map(callable $callback, array $collection) { return array_merge([], ...array_map($callback, $collection)); }; var_dump( array_map(function ($el) { return str_split($el); }, ["two birds", "three green peas"]) ); var_dump( flat_map(function ($el) { return str_split($el); }, ["two birds", "three green peas"]) ); var_dump( flat_map(function ($el) { return str_split($el); }, []) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qQNTv
function name:  (null)
number of ops:  25
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
   10     1        INIT_FCALL                                               'array_map'
          2        DECLARE_LAMBDA_FUNCTION                          ~0      [0]
          3        SEND_VAL                                                 ~0
          4        SEND_VAL                                                 <array>
          5        DO_ICALL                                         $1      
          6        SEND_VAR                                                 $1
    9     7        DO_ICALL                                                 
   13     8        INIT_FCALL                                               'var_dump'
   14     9        INIT_FCALL                                               'flat_map'
         10        DECLARE_LAMBDA_FUNCTION                          ~3      [1]
         11        SEND_VAL                                                 ~3
         12        SEND_VAL                                                 <array>
         13        DO_FCALL                                      0  $4      
         14        SEND_VAR                                                 $4
   13    15        DO_ICALL                                                 
   17    16        INIT_FCALL                                               'var_dump'
   18    17        INIT_FCALL                                               'flat_map'
         18        DECLARE_LAMBDA_FUNCTION                          ~6      [2]
         19        SEND_VAL                                                 ~6
         20        SEND_VAL                                                 <array>
         21        DO_FCALL                                      0  $7      
         22        SEND_VAR                                                 $7
   17    23        DO_ICALL                                                 
   19    24      > 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/qQNTv
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $el
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'str_split'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
          5*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qQNTv
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $el
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'str_split'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
          5*     > RETURN                                                   null

End of Dynamic Function 1

Dynamic Function 2
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qQNTv
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $el
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'str_split'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
          5*     > RETURN                                                   null

End of Dynamic Function 2

Function flat_map:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qQNTv
function name:  flat_map
number of ops:  13
compiled vars:  !0 = $callback, !1 = $collection
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'array_merge'
          3        SEND_VAL                                                 <array>
          4        INIT_FCALL                                               'array_map'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $2      
          8        SEND_UNPACK                                              $2
          9        CHECK_UNDEF_ARGS                                         
         10        DO_ICALL                                         $3      
         11      > RETURN                                                   $3
    6    12*     > RETURN                                                   null

End of function flat_map

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.56 ms | 1016 KiB | 19 Q