Re: Self generating variables/arrays

From: Date: Mon, 27 Nov 2006 04:01:27 +0000
Subject: Re: Self generating variables/arrays
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-245166@lists.php.net to get a copy of this message
On Sun, November 26, 2006 3:45 pm, jekillen wrote: > 1. one large array exploded around \n > 2. then a loop looks for '<br><br>\n' items > and records the index number of these items > as well of keeping a count: ($c) > 3. Since $c is a variable it can represent a different > number each time. > 4. Since I don't know what $c is going to be I can't > declare array variables with predetermined names You don't NEED to track the number of items: PHP is happy to do that for you: $a[$i][] = "next item"; > 5. I want to slice the large array into $c arrays that > begin and end around items in the large array > containing '<br><br>\n'; > This is as much abstraction as I can give you > In context it is represented by several hundred lines of function > code. I strongly suspect that you could simplify your code to a large degree... Post a small "slice" out of your data and see what folks think. You may be taking a very long route to your destination... -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.general (#245166) next »