-1

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?

orhs
  • 1
  • 1

2 Answers2

0

In this array, the first index is an object of Copyleaks\ResultRecord. So you would need to access it like below.

$array[0]->Percents;

If you are looping then

foreach($array as $key=>$value) {
    $value->Percents; //Percents that you are looking for
}
Rakesh
  • 173
  • 7
0

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.

Imran
  • 4,582
  • 2
  • 18
  • 37