3v4l.org

run code in 300+ PHP versions simultaneously
<?php $meta = [ 'stationFrom' => 'Antwerpen', 'stationTo' => 'London', 'places' => [1, 3, 4], ]; $formattedMeta = [ 'stationFrom' => 'Antwerpen', 'stationTo' => 'London', 'places' => function($meta) { return implode(',', $meta['places']); } ]; $formattedMeta['places']($meta); echo json_encode($formattedMeta);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CCDUY
function name:  (null)
number of ops:  15
compiled vars:  !0 = $meta, !1 = $formattedMeta
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_ARRAY                                       ~3      'Antwerpen', 'stationFrom'
   11     2        ADD_ARRAY_ELEMENT                                ~3      'London', 'stationTo'
   12     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FCCDUY%3A12%240'
   14     4        ADD_ARRAY_ELEMENT                                ~3      ~4, 'places'
    9     5        ASSIGN                                                   !1, ~3
   17     6        FETCH_DIM_R                                      ~6      !1, 'places'
          7        INIT_DYNAMIC_CALL                                        ~6
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
   19    10        INIT_FCALL                                               'json_encode'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $8      
         13        ECHO                                                     $8
         14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FCCDUY%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CCDUY
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $meta
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 '%2C'
          3        FETCH_DIM_R                                      ~1      !0, 'places'
          4        SEND_VAL                                                 ~1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
   14     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FCCDUY%3A12%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.43 ms | 1395 KiB | 17 Q