GetDotted Domains

Viewing Thread:
"PHP: nested while loops"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Mon 31/01/05 at 13:02
Regular
"NULL"
Posts: 1,384
I am trying to do some nested looping but it's not working with "while" statements.

When the nested while returns false, it fails the parent while loop as well.

Any thoughts?
Mon 31/01/05 at 14:21
Regular
"It goes so quickly"
Posts: 4,083
If I've read your example right:

$stringa = "Volume 5 -||- Issue 1 -||- Article 1";
$array = explode(" -||- ",$string); # Create array.
$stringb = implode(" -||- ",$array); # Put it back together.

Mind if I ask how you sorted the first problem (just curious)?
Mon 31/01/05 at 14:10
Regular
"NULL"
Posts: 1,384
I've devised a messy hack for it by changing the string dividers such that the string resembles an array, then used the eval() function on it.

It works, but if anyone knows of a better way to do it, please let me know!
Mon 31/01/05 at 13:57
Regular
"NULL"
Posts: 1,384
OK, I've solved the problem, got another one though...

I have some strings, and I need them turning into arrays, e.g.:

Volume 5 -||- Issue 1 -||- Article 1
--> $array['Volume 5']['Issue 1']['Article 1'] = array()

Volume 5 -||- Issue 1 -||- Article 2
--> $array['Volume 5']['Issue 1']['Article 2'] = array()

But they're not always the same depth of array, e.g. I might have:

Volume 5 -||- Issue 1 -||- Subsection A -||- Article 1
--> $array['Volume 5']['Issue 1']['Subsection A']['Article 1'] = array()

Any thoughts?
Mon 31/01/05 at 13:38
Regular
"Pouch Ape"
Posts: 14,499
I've always used these and never had a problem.

Is the code small enough to paste here?
Mon 31/01/05 at 13:02
Regular
"NULL"
Posts: 1,384
I am trying to do some nested looping but it's not working with "while" statements.

When the nested while returns false, it fails the parent while loop as well.

Any thoughts?

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Impressive control panel
I have to say that I'm impressed with the features available having logged on... Loads of info - excellent.
Phil
Many thanks!!
Registered my website with Freeola Sites on Tuesday. Now have full and comprehensive Google coverage for my site. Great stuff!!
John Shepherd

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.