3v4l.org

run code in 300+ PHP versions simultaneously
<?php function serializeContext($default, $optional) { return "'" . implode("', '", array_merge( $default, $optional )) . "'" ; } $a = array('test1', 'test2', 'test3'); $b = array('test4'); 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(serializeContext(explode(' ', array_reduce($a, function($carry, $next){ return $carry .= " $next"; }, 'IN')), $b));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/35EYP
function name:  (null)
number of ops:  27
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   13     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'serializecontext'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   24     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'serializecontext'
         11        INIT_FCALL                                               'explode'
         12        SEND_VAL                                                 '+'
         13        INIT_FCALL                                               'array_reduce'
         14        SEND_VAR                                                 !0
         15        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F35EYP%3A24%240'
   26    16        SEND_VAL                                                 ~6
         17        SEND_VAL                                                 'IN'
         18        DO_ICALL                                         $7      
         19        SEND_VAR                                                 $7
         20        DO_ICALL                                         $8      
         21        SEND_VAR                                                 $8
         22        SEND_VAR                                                 !1
         23        DO_FCALL                                      0  $9      
         24        SEND_VAR                                                 $9
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Function serializecontext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/35EYP
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%2F35EYP%3A24%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/35EYP
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $carry, !1 = $next
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   25     2        NOP                                                      
          3        FAST_CONCAT                                      ~2      '+', !1
          4        ASSIGN_OP                                     8  ~3      !0, ~2
          5      > RETURN                                                   ~3
   26     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F35EYP%3A24%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
199.23 ms | 1403 KiB | 25 Q