phpjsonapimultidimensional-arrayplagiarism-detection

Accessing multidimensional array in Php


I print the multidimensional array which I get from an API and the goal is to loop over the array and check of the field [Percents] is greater than 20 but with no success: This is how the array looks like: Multidimensional array

How do I get the number which appears right after the word Percents?


Solution

  • You can access the Percents as below:

    foreach($arrays as $array){
        if(isset($array->Percents){
            echo $array->Percents;
        }
    }
    

    Here, I am echoing the percents, you can even put it in some other variables.