3v4l.org

run code in 300+ PHP versions simultaneously
<?php $keys = [ 'my', 'name', 'is', 'Rafael' ]; $value = 'value'; $result = array_reduce( array_reverse( $keys ), function ( $c, $i ) use ( $value ) { return [ $i => ( is_null( $c ) ? $value : $c ) ]; } ); print_r( $result ); // или $result = array_reduce( array_reverse( $keys ), fn( $c, $i ) => [ $i => $c ?? $value ] ); print_r( $result );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tLFqe
function name:  (null)
number of ops:  29
compiled vars:  !0 = $keys, !1 = $value, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 'value'
    6     2        INIT_FCALL                                               'array_reduce'
          3        INIT_FCALL                                               'array_reverse'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        SEND_VAR                                                 $5
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FtLFqe%3A6%240'
          8        BIND_LEXICAL                                             ~6, !1
    8     9        SEND_VAL                                                 ~6
         10        DO_ICALL                                         $7      
    6    11        ASSIGN                                                   !2, $7
    9    12        INIT_FCALL                                               'print_r'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
   11    15        INIT_FCALL                                               'array_reduce'
         16        INIT_FCALL                                               'array_reverse'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $10     
         19        SEND_VAR                                                 $10
         20        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FtLFqe%3A11%241'
         21        BIND_LEXICAL                                             ~11, !1
         22        SEND_VAL                                                 ~11
         23        DO_ICALL                                         $12     
         24        ASSIGN                                                   !2, $12
   12    25        INIT_FCALL                                               'print_r'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FtLFqe%3A6%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tLFqe
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $c, !1 = $i, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
    7     3        TYPE_CHECK                                    2          !0
          4      > JMPZ                                                     ~3, ->7
          5    >   QM_ASSIGN                                        ~4      !2
          6      > JMP                                                      ->8
          7    >   QM_ASSIGN                                        ~4      !0
          8    >   INIT_ARRAY                                       ~5      ~4, !1
          9      > RETURN                                                   ~5
    8    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FtLFqe%3A6%240

Function %00%7Bclosure%7D%2Fin%2FtLFqe%3A11%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tLFqe
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $c, !1 = $i, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        COALESCE                                         ~3      !0
          4        QM_ASSIGN                                        ~3      !2
          5        INIT_ARRAY                                       ~4      ~3, !1
          6      > RETURN                                                   ~4
          7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FtLFqe%3A11%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.06 ms | 1405 KiB | 19 Q