Re: [PHP] unset in foreach breaks recrusion

2008-07-01 Thread Roberto Costumero Moreno
} > } > } > if($return){return $sorted;} > } > > > Well, I guess that's it, I'm sure I can think of > another way to cut execution time, but, well, > I don't have much time for it :)

Re: [PHP] Simple array problem

2008-07-01 Thread Roberto Costumero Moreno
I think the problem is easier... and also the solutions doing a "for" instead of "foreach" are not good solutions because if the array is not index-consecutive the loop fails. So, if you has an array with the colors as indexes and the integer value X as the value for that position of the array, up

Re: [PHP] unset in foreach breaks recrusion

2008-06-30 Thread Roberto Costumero Moreno
I would be happy to know how to. > > > Thanks Robero, this is first time I'm looking for help in mailing list, > and I was starting to regret writing here, but your reply changed it :) > > Thanks! > > David. > > > > On Mon, Jun 30, 2008 at

Re: [PHP] unset in foreach breaks recrusion

2008-06-30 Thread Roberto Costumero Moreno
That's not the problem. Look that the function is called with &$return, so there is a reference to the variable in which the function returns the value (if not there would not be an answer...). Otherwise, i think the problem is in the recursive call inside the function. Once you make the unset, yo

Re: [PHP] Re: Early return (was: Inspiration for a Tombstone.)

2008-06-29 Thread Roberto Costumero Moreno
There is a point between Multiple & early return vs. One last return, which is Efficiency. Imagine you have a code which makes lots of things. What is better in time? If you have early returns, your script will only do the operations it has to, nothing more than it has to do. If you have your da