[phpa] Re: class not found

  • From: "Mark Rogers" <mark@xxxxxxxxxxxxxx>
  • To: <phpa@xxxxxxxxxxxxx>
  • Date: Tue, 2 Apr 2002 08:56:15 +0100

> > function test () {
> >
> >   function i_am_embeded() { ... }
> >
> >   for(;;) { i_am_embebed(..) }
> >
> > }
>
> [...] Functions inside functions is not an idiom that I
> recommend, and it isn't handled by PHP in the way
> that it should be.

I agree that its not a nice way to do things, and I'd certainly avoid it,
but having said that I have had to use it (I can't remember the exact reason
why right now, but it was a good enough reason at the time for me to
overcome my natural dislike for the idea).

Out of curiosity, if the i_am_embedded() function definition is moved out to
a second file and include_once'd instead (at the same point in test()), does
that work? That might at least be a workaround if it does.

> i.e. the inner function doens't cease
> to exist once the outer function has
> completed execution (but correct me
> if I'm wrong).

You are correct.

Mark Rogers, Quarella Ltd

------------------------------------------------------------------------
  www.php-accelerator.co.uk           Home of the free PHP Accelerator

To post, send email to phpa@xxxxxxxxxxxxx
To unsubscribe, email phpa-request@xxxxxxxxxxxxx with subject unsubscribe


Other related posts: