0

This is an additional question from this.

I have this array containing multiple values as well as arrays. I know that I can use

$data['property'] = value;

And since I'm in the view after sending the $data to it, I know I can

echo $PROPERTY; 

However, this array also contains arrays.

[0] => Array ( [CSS] => css/style_centre_paiement_paiements_1.css [PAGE_NAME] =>
ACCUEIL [RANK] => PARENT [THREAD] => Accueil [FULL_NAME] => Marc Bélanger [C1] => Accueil
[C2] => Inscription - Enfant
[C3] => Centre de Paiement
[C4] =>Nous contacter
[C5] =>Votre compte
[C6] => 
[C7] =>Déconnexion
)[1] => Array ( [0] => Array ( [TITRE]...

The [1] contains an array of several [TITRE],[MESSAGE][DATE] sets. Right now, by sending this total array to the view, I can echo things like $THREAD and get the correct value. But how should I proceed to access the value of each of my sets ? Since the array of sets is in [1], then [0], I don't really know how to do it. And I don't want to to echo [TITRE] because there is more than one [TITRE] and I want to show them all, not just one. What I would like would be to do something like this :

foreach ($alert as $row)
    {
      ....
    }

Any clue how to help ?

1

1 Answer 1

2

Not really sure what you mean, but if you want to do a foreach() with an array you could try

foreach ($array as $array => $subarray)
{
//code
}
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.