3v4l.org

run code in 300+ PHP versions simultaneously
<?php function serializeContext($default, $optional) { return "'" . implode("', '", array_merge( $default, $optional )) . "'" ; } $a = array( array('test1', 'test2', 'test3'), array('test4', 'test5', 'test6') ); $b = array('test7'); // var_dump(serializeContext($a, $b)); // echo array_reduce($a, // function($carry, $next){ // return $carry . $next; // }, ''); // var_dump(array_reduce($a, function($carry, $next){ // return $carry .= " $next"; // })); // var_dump(array_reduce($a, function($carry, $next){ // $carry[] = $next; // return $carry; // })); array_reduce($a, function($carry, $next){ $carry[] = $next; print_r(array_column($carry)); }, array());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RbVG9
function name:  (null)
number of ops:  9
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, <array>
   32     2        INIT_FCALL                                               'array_reduce'
          3        SEND_VAR                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FRbVG9%3A32%240'
   38     5        SEND_VAL                                                 ~4
          6        SEND_VAL                                                 <array>
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function serializecontext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RbVG9
function name:  serializeContext
number of ops:  14
compiled vars:  !0 = $default, !1 = $optional
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'implode'
          3        SEND_VAL                                                 '%27%2C+%27'
          4        INIT_FCALL                                               'array_merge'
    5     5        SEND_VAR                                                 !0
    6     6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                         $3      
         10        CONCAT                                           ~4      '%27', $3
    7    11        CONCAT                                           ~5      ~4, '%27'
         12      > RETURN                                                   ~5
    8    13*     > RETURN                                                   null

End of function serializecontext

Function %00%7Bclosure%7D%2Fin%2FRbVG9%3A32%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RbVG9
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $carry, !1 = $next
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   34     2        ASSIGN_DIM                                               !0
          3        OP_DATA                                                  !1
   36     4        INIT_FCALL                                               'print_r'
          5        INIT_FCALL                                               'array_column'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        DO_ICALL                                                 
   38    10      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FRbVG9%3A32%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
353.14 ms | 1400 KiB | 23 Q