Tell me more x
, there is a new speed test available. Give it a try, leave feedback!
dslreports logo
 
    All Forums Hot Topics Gallery
spc

spacer

Search Topic:
uniqs
754
share rss forum feed


Ashke
Flips page and continues reading
Premium
join:2007-09-11
Minneapolis, MN

2 edits

foreach array help?

I'm having trouble running the foreach function for the arrays.

I'm trying to create a breadcrumb engine of my own.... I have 3 different arrays. each of them is each tier in the directory.

I'm having trouble with the foreach part. I want it to look at each particle of the array.

If $_GET['page'] is equal to the page_name portion of the array, then I want it to add the Page Title to the breadcrumbs string. But it's showing errors as in invalid argument when I try to do that. It says that it was expecting ')' at Line 40...

Can someone please help out?

--
-Ashke


cdru
Go Colts
Premium,MVM
join:2003-05-14
Fort Wayne, IN
kudos:7
Try
foreach ($firstLevel as $one => $two){


Ashke
Flips page and continues reading
Premium
join:2007-09-11
Minneapolis, MN
said by cdru:

Try
foreach ($firstLevel as $one => $two){

Nope... Didn't work.

This is the error message that I am getting... Warning: Invalid argument supplied for foreach() in C:\wamp\www\template\breadcrumbs.php on line 40
--
-Ashke


Ashke
Flips page and continues reading
Premium
join:2007-09-11
Minneapolis, MN
reply to cdru
Sorry if my code seems to be the stating-the-stupid's-obvious way. I'm just putting it into debugging mode until the code works out smoothly. Helps me pin point the errors.
--
-Ashke


cdru
Go Colts
Premium,MVM
join:2003-05-14
Fort Wayne, IN
kudos:7
reply to Ashke
I corrected a typo immediately, but it looks like you used the original one. The =< should have been => as is currently reflected in my post above.


Ashke
Flips page and continues reading
Premium
join:2007-09-11
Minneapolis, MN
said by cdru:

I corrected a typo immediately, but it looks like you used the original one. The =< should have been => as is currently reflected in my post above.

Not quite sure I follow...

The foreach is generally perplexing to me when it comes to multi-dimensional arrays.
--
-Ashke


Ashke
Flips page and continues reading
Premium
join:2007-09-11
Minneapolis, MN
reply to cdru
I tried all of the following:


None of the above work :(

--
-Ashke


Ashke
Flips page and continues reading
Premium
join:2007-09-11
Minneapolis, MN
Scratch that... I had a typo when I did my coding to do as you suggested... the => works.
--
-Ashke