OZONE Asylum
Forums
Server-Side Scripting - Oh my!
PHP seems to "forget" changes made to an array in a loop.
This page's ID:
30951
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
I will bet even money that your $$ magic doesn't do what you think it does. And you don't really need it. Rework your code to live without it (use recursion, much cleaner). Probably your last $$varString = array() just resets your $tree... here, from the top of my head, untested... [code] function createTree($lines, $depth = 1) { if (!is_array($lines)) $lines = split("\n", lines); $tree = array(); while (count($lines) > 0 ) { $nextLine = array_unshift($lines); $newDepth = strspn($nextLine,'*'); $lineName = substr($nextLine, $newDepth); if ($newDepth == $depth) { $tree[$lineName] = array(); $lastName = &$lineName; } else { $tree[$lineName] = createTree($lines, $depth + 1); } return $tree; } [/code] so long, ->Tyberius Prime
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »
Maximum Security
OZONE
DHTML/Javascript
Server-Side Scripting - Oh my!
CSS - DOM - XHTML - XML - XSL - XSLT
Stupid Basic HTML
Visual Therapy
Photoshop
Photoshop Pong, Anyone?
***WARNING*** BIG SIG APPROACHING
Photography
3D Modelling & Rendering
Multimedia/Animation
Print Graphics
Holding Pens
Philosophy and other Silliness
Outpatient Counseling
Site reviews!
Mad Scientists' Laboratory
Getting to know the Grail