Re: Functions defined within other functions
| From: | Lars Torben Wilson | Date: | Wed, 30 Aug 2000 22:32:37 +0000 |
| Subject: | Re: Functions defined within other functions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14477@lists.php.net to get a copy of this message | ||
Heikki Korpela writes:
>
> I couldn't find any explanation of functions defined within other functions
> in the PHP manual. If they are not documented, I propose that they are
> documented.
>
> Example of an inner function:
>
> <?php
> function Outer() {
> function Inner() {
> print 'bar';
> }
> print 'foo';
> Inner();
> print "\n";
> }
> Outer();
> ?>
>
> --
> | Heikki Korpela | heikki.korpela@wapit.com | tel. +358 50 3838 609 |
> | Software Developer, Wapit Finland |
> http://www.wapit.com |
> --
> "Even though it does not work, how does it feel?"
From http://www.php.net/manual/functions.php:
Any valid PHP code may appear inside a function, even other
functions and class definitions.
Of course, the second time you call that function you'll get a fatal
error. :) This is because you can only declare functions once.
Hope this helps,
Torben
--
+----------------------------------------------------------------+
|Torben Wilson <torben@php.net> Netmill iTech|
|http://www.coastnet.com/~torben http://www.netmill.fi|
|Ph: 1 250 383-9735 torben@netmill.fi|
+----------------------------------------------------------------+