1

Hi would love some help on how to perform this. Cause so far what I'm doing now is failing. this is the sample output of json turned to array.

        Array
    (
        [0] => Array
            (
                [0] => Array
                    (
                        [value] => lit-PR-00-Preparing-Precise-Polymer-Solutions.html
                    )

            )

        [1] => Array
            (
                [0] => Array
                    (
                        [value] => 90Plus
                    )

            )

        [2] => Array
            (
                [0] => Array
                    (
                        [value] => Particle Size Analyzer
                    )

            )

    )

So far this is what I got so far and It's still not outputting the value I need. Would appreciate some help on what I'm doing wrong thanks.

$decode = json_decode($row['elements'], true);

                echo '<pre>';
                //print_r($decode);
                print_r(array_values($decode));
                echo '</pre>';

                echo ($value['0'][1][value]);

1 Answer 1

1
$decode = json_decode($row['elements'], true);

// iterate through array
foreach($decode as $array_row) {
  echo $array_row[0]['value'];
}

// display specific row #2
echo $decode[2][0]['value'];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.