php-general Digest 31 Oct 2009 20:51:04 -0000 Issue 6420

Topics (messages 299543 through 299546):

mysql resoc iterator
        299543 by: viraj

Re: Help with my first recursion menu
        299544 by: Lex Braun
        299545 by: MEM

Two Parser Passes
        299546 by: Daniel Kolbo

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
can somebody point me to a good article or a piece of code on
implementing an iterator for a mysql result resource?

actually this is for an oracle statement handle, all i want is to
fetch the results as it is from a multi dimensional array. so i can
use it in a for each with keys

IteratorAggregate over Iterator seems the best fit for the task as i
do not want seeking back and forth.

thanks!

~viraj

--- End Message ---
--- Begin Message ---
Hi,

On Wed, Oct 28, 2009 at 5:22 PM, MEM <tal...@gmail.com> wrote:

>  I've been told that stack is the way to go, so I'm trying to understand
> the
> following code:
> http://pastebin.com/m5616c88f
> I've commented every line so that any of you could see if I'm interpreting
> something wrong:
>
>
> I have two questions about this code, that hopefully someone on the list
> could explain:
>
> 1)
> Why do we need to remove the last array item? (on line 32):
> array_pop($urlStack);
>
On line 20, $url creates an URL path that includes the $cat path.  Once
you've completed iteration on all children of $cat, the url path should no
longer include $cat path, thus it is removed from $urlStack.


>
> 2)
> Why we print the closed tag of the li element, after the recursive call?
> (on
> line 29)
> echo "</li>\n";
>
Line 29 is closing the li element that was opened on line 23 for $cat.

>
>
> Thanks a lot in advance,
> Márcio
>
-Lex

--- End Message ---
--- Begin Message ---
 
From: Lex Braun [mailto:lex.br...@gmail.com] 
Sent: sábado, 31 de Outubro de 2009 14:05
To: MEM
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] RE: Help with my first recursion menu
 
Hi,
On Wed, Oct 28, 2009 at 5:22 PM, MEM <tal...@gmail.com> wrote:
I've been told that stack is the way to go, so I'm trying to understand the
following code:
http://pastebin.com/m5616c88f
I've commented every line so that any of you could see if I'm interpreting
something wrong:


I have two questions about this code, that hopefully someone on the list
could explain:

1)
Why do we need to remove the last array item? (on line 32):
array_pop($urlStack);
On line 20, $url creates an URL path that includes the $cat path.  Once you've 
completed iteration on all children of $cat, the url path should no longer 
include $cat path, thus it is removed from $urlStack.
 

2)
Why we print the closed tag of the li element, after the recursive call? (on
line 29)
echo "</li>\n";
Line 29 is closing the li element that was opened on line 23 for $cat.


Thanks a lot in advance,
Márcio
-Lex
 
 
 
 
Thanks a lot. I knew that:
“Line 29 is closing the li element that was opened on line 23 for $cat.”
 
My question intend to be more like:
Why that line to close the li element is *after* the recursive call? 
Somehow, it seems that instead of creating something like this:
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
 
We are doing:
<ul>
<li>item1
<li>item2
<li>item3
</li>
</ul>
 
Anyway, the main doubt was the first. I will test this and see what I get. 
 
Thanks a lot for your reply.
Regards,
Márcio
 

--- End Message ---
--- Begin Message ---
Hello,

Is it possible to get a list (array) of classes not found in a script
before the fatal error exits the parser.  I realize that PHP parses the
script twice.  It would be nice at the end of the first parsing pass to
check to see which classes haven't been defined (yet), so that I could
define them before the second pass.  This way I could load only those
classes a script needs.

Thanks in advance,
dK
`

--- End Message ---

Reply via email to