3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '[{"name":"Colour","value":"Green"},{"name":"Size","value":"Small"},{"name":"Thickness","value":"Narrow"}] '; $dataArray = json_decode($str, true); $outputString = ""; foreach($dataArray as $data) { foreach($data as $key => $element) { $outputString .= $key.": ".$element.PHP_EOL; } $outputString .= PHP_EOL; } echo $outputString;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 20
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 17
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/4vpfv
function name:  (null)
number of ops:  23
compiled vars:  !0 = $str, !1 = $dataArray, !2 = $outputString, !3 = $data, !4 = $element, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%7B%22name%22%3A%22Colour%22%2C%22value%22%3A%22Green%22%7D%2C%7B%22name%22%3A%22Size%22%2C%22value%22%3A%22Small%22%7D%2C%7B%22name%22%3A%22Thickness%22%2C%22value%22%3A%22Narrow%22%7D%5D%0A'
    6     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
    7     6        ASSIGN                                                   !2, ''
    8     7      > FE_RESET_R                                       $10     !1, ->20
          8    > > FE_FETCH_R                                               $10, !3, ->20
    9     9    > > FE_RESET_R                                       $11     !3, ->17
         10    > > FE_FETCH_R                                       ~12     $11, !4, ->17
         11    >   ASSIGN                                                   !5, ~12
   10    12        CONCAT                                           ~14     !5, '%3A+'
         13        CONCAT                                           ~15     ~14, !4
         14        CONCAT                                           ~16     ~15, '%0A'
         15        ASSIGN_OP                                     8          !2, ~16
    9    16      > JMP                                                      ->10
         17    >   FE_FREE                                                  $11
   12    18        ASSIGN_OP                                     8          !2, '%0A'
    8    19      > JMP                                                      ->8
         20    >   FE_FREE                                                  $10
   14    21        ECHO                                                     !2
   15    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.43 ms | 1396 KiB | 15 Q