3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ "1_apartment_bldgs"=>["geraldine", "jai_sai"], "2_housings"=>["housing_prototype", "bla"] ]; $output = []; foreach ($input as $key => $arr) { $arr2 = []; foreach ($arr as $p) { $arr2[$p] = ['project' => ucwords(str_replace('_', ' ', $p))]; } $output[$key] = $arr2; } echo json_encode($output, JSON_PRETTY_PRINT);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 24
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 20
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 20
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/XjgFZ
function name:  (null)
number of ops:  31
compiled vars:  !0 = $input, !1 = $output, !2 = $arr, !3 = $key, !4 = $arr2, !5 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, <array>
    7     2      > FE_RESET_R                                       $8      !0, ->24
          3    > > FE_FETCH_R                                       ~9      $8, !2, ->24
          4    >   ASSIGN                                                   !3, ~9
    8     5        ASSIGN                                                   !4, <array>
    9     6      > FE_RESET_R                                       $12     !2, ->20
          7    > > FE_FETCH_R                                               $12, !5, ->20
   10     8    >   INIT_FCALL                                               'ucwords'
          9        INIT_FCALL                                               'str_replace'
         10        SEND_VAL                                                 '_'
         11        SEND_VAL                                                 '+'
         12        SEND_VAR                                                 !5
         13        DO_ICALL                                         $14     
         14        SEND_VAR                                                 $14
         15        DO_ICALL                                         $15     
         16        INIT_ARRAY                                       ~16     $15, 'project'
         17        ASSIGN_DIM                                               !4, !5
         18        OP_DATA                                                  ~16
    9    19      > JMP                                                      ->7
         20    >   FE_FREE                                                  $12
   12    21        ASSIGN_DIM                                               !1, !3
         22        OP_DATA                                                  !4
    7    23      > JMP                                                      ->3
         24    >   FE_FREE                                                  $8
   15    25        INIT_FCALL                                               'json_encode'
         26        SEND_VAR                                                 !1
         27        SEND_VAL                                                 128
         28        DO_ICALL                                         $18     
         29        ECHO                                                     $18
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.42 ms | 941 KiB | 20 Q