Re: Structured Code vs. Performance
| From: | Robert Cummings | Date: | Thu, 29 Nov 2007 15:56:08 +0000 |
| Subject: | Re: Structured Code vs. Performance | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-265239@lists.php.net to get a copy of this message | ||
On Thu, 2007-11-29 at 12:13 +0000, Stut wrote:
>
> Not ;). There is no such thing as a compile-time definition in PHP.
There certainly is...
<?php
if( !function_exists( 'file_put_contents' ) )
{
$def = <<<_
function file_put_contents
( \$filename, \$data, \$flags=0, \$context=null )
{
// :)
}
_;
eval( $def );
}
?>
Now, I'm not necessarily advocating this style of compatibility
programming, but I remember seeing something like it in PEAR. I think it
might have been the pear SOAP classes where the classes had to be
declared dynamically.
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................