3v4l.org

run code in 500+ PHP versions simultaneously
<?php $json = '{ "world": { "france": { "city": { "city_1": { "name": "paris", "titre": "lorem ipsum" }, "city_2": { "name": "marseille", "titre": "dolor sit amet" } } }, "usa": { "city": { "city_1": { "name": "new york", "titre": "lorem ipsum" }, "city_2": { "name": "los angeles", "titre": "lorem ipsum" }, "city_3": { "name": "portland", "titre": "lorem ipsum" } } } } }'; $data = json_decode($json, true); $scenario = ''; foreach($data['world'] as $country=>$cities) { $cityArray = array(); foreach($cities['city'] as $key=>$values) { $cityArray[] = $values['name']; } $scenario .= '<option value="'.$country.'" data-city="'.implode(',', $cityArray).'">'.$country.'</option>'; } echo $scenario;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 30
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 30
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 20
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/l986m
function name:  (null)
number of ops:  33
compiled vars:  !0 = $json, !1 = $data, !2 = $scenario, !3 = $cities, !4 = $country, !5 = $cityArray, !6 = $values, !7 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%7B%0A%22world%22%3A+%7B%0A++++%22france%22%3A+%7B%0A++++++++%22city%22%3A+%7B%0A++++++++++++%22city_1%22%3A+%7B%0A++++++++++++++++%22name%22%3A+%22paris%22%2C%0A++++++++++++++++%22titre%22%3A+%22lorem+ipsum%22%0A++++++++++++%7D%2C%0A++++++++++++%22city_2%22%3A+%7B%0A++++++++++++++++%22name%22%3A+%22marseille%22%2C%0A++++++++++++++++%22titre%22%3A+%22dolor+sit+amet%22%0A++++++++++++%7D%0A++++++++%7D%0A++++%7D%2C%0A++++%22usa%22%3A+%7B%0A++++++++%22city%22%3A+%7B%0A++++++++++++%22city_1%22%3A+%7B%0A++++++++++++++++%22name%22%3A+%22new+york%22%2C%0A++++++++++++++++%22titre%22%3A+%22lorem+ipsum%22%0A++++++++++++%7D%2C%0A++++++++++++%22city_2%22%3A+%7B%0A++++++++++++++++%22name%22%3A+%22los+angeles%22%2C%0A++++++++++++++++%22titre%22%3A+%22lorem+ipsum%22%0A++++++++++++%7D%2C%0A++++++++++++%22city_3%22%3A+%7B%0A++++++++++++++++%22name%22%3A+%22portland%22%2C%0A++++++++++++++++%22titre%22%3A+%22lorem+ipsum%22%0A++++++++++++%7D%0A++++++++%7D%0A++++%7D%0A%7D%0A%7D'
   36     1        INIT_FCALL                                                   'json_decode'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     <true>
          4        DO_ICALL                                             $9      
          5        ASSIGN                                                       !1, $9
   37     6        ASSIGN                                                       !2, ''
   38     7        FETCH_DIM_R                                          ~12     !1, 'world'
          8      > FE_RESET_R                                           $13     ~12, ->30
          9    > > FE_FETCH_R                                           ~14     $13, !3, ->30
         10    >   ASSIGN                                                       !4, ~14
   39    11        ASSIGN                                                       !5, <array>
   40    12        FETCH_DIM_R                                          ~17     !3, 'city'
         13      > FE_RESET_R                                           $18     ~17, ->20
         14    > > FE_FETCH_R                                           ~19     $18, !6, ->20
         15    >   ASSIGN                                                       !7, ~19
   41    16        FETCH_DIM_R                                          ~22     !6, 'name'
         17        ASSIGN_DIM                                                   !5
         18        OP_DATA                                                      ~22
   40    19      > JMP                                                          ->14
         20    >   FE_FREE                                                      $18
   43    21        CONCAT                                               ~23     '%3Coption+value%3D%22', !4
         22        CONCAT                                               ~24     ~23, '%22+data-city%3D%22'
         23        FRAMELESS_ICALL_2                implode             ~25     '%2C', !5
         24        CONCAT                                               ~26     ~24, ~25
         25        CONCAT                                               ~27     ~26, '%22%3E'
         26        CONCAT                                               ~28     ~27, !4
         27        CONCAT                                               ~29     ~28, '%3C%2Foption%3E'
         28        ASSIGN_OP                                         8          !2, ~29
   38    29      > JMP                                                          ->9
         30    >   FE_FREE                                                      $13
   46    31        ECHO                                                         !2
   47    32      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
218.84 ms | 2034 KiB | 14 Q