Re: [PHP4BETA] Undocumented behavior of PHP 3.0
| From: | Thies C. Arntzen | Date: | Sat, 15 May 1999 10:10:11 +0000 |
| Subject: | Re: [PHP4BETA] Undocumented behavior of PHP 3.0 | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-864@lists.php.net to get a copy of this message | ||
On Fri, 14 May 1999, Zeev Suraski wrote:
>
> An undocumented behavior of PHP 3.0 was the fact that functions could be
> declared inside control structures, such as if statements or other
> functions.
>
> For example:
>
> function declare_foo()
> {
> function foo()
> {
> code
> }
> }
month ago i started to use something like this:
in my "pre-file":
<?php
$GLOBALS[ "_dcinclude" ] = array();
function dcinclude($file)
{ if (isset($GLOBALS[ "_dcinclude" ][ $file ]))
{ $GLOBALS[ "_dcinclude" ][ $file ]++;
return;
}
$GLOBALS[ "_dcinclude" ][ $file ] = 1;
include "../../php/package/phpbasic/phpsite/".$file;
}
?>
-------------------------------------
mypage.php3:
<?php
dcinclude("database.fnc");
....
?>
---------------------------------------
that way i can make sure that every file only gets included once & every "function"
file can include all the stuff it depends on which makes life easier for our application-developers.
i think a lot of people use something like this - even though there are some problems with nested
includes in php3.
i belive we should support it in the future.
another thing "nice to have" would be some kind of "include_once" function. that
would make life far easier when using includes that need includes.
tc
>
> could be used so that you could declare foo() selectively. This
> behavior was never documented, and pretty much goes against compilation.
>
> My question is, especially for the PHPlib guys - were you aware of this
> behavior, and did you take advantage of it? If it was something many
> people relied on, it might be worth it to consider implementing it in
> Zend, even though it's not that easy (to say the least).
>
> Zeev
>
> --
> -----------------------------------------------------
> Zeev Suraski <zeev@zend.com>
> For a PGP public key, finger bourbon@netvision.net.il
>
>
>
> --
> PHP 4 Beta
>
>
>
Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!"
Digital Collections Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93 20097 Hamburg / Germany
--
PHP 4 Beta