1
I have a comeback JSON.
"members": [
{
"name": "Drogo",
"role": 3,
"donations": 278,
Where do I use the foreach
to travel it!
foreach ( $CMAMBERS as $e )
{
echo "nome: $e->name<br>";
}
I need to sort the amount I receive in descending order, not according to the $e->name
, but rather the $e->donations
then I need to display the names in descending order according to the array donations
So if I have the following values:
"Name": "Drogo"
"donations": "150"
"Name": "FoX"
"donations": "350"
"Name": "TRE"
"donations": "250"
I should print like this:
"FoX"
"TRE"
"Drogo"
How can I do that?
I believe it is not possible to use inside the foreach, I need to use inside it!
– FoX
Make the ordination before the
foreach
. I updated the answer and the working examples.– NoobSaibot
Ah, yes of course... Thank you!
– FoX