Re: [PHP] Structured Code vs. Performance
- From: robert@xxxxxxxxxxxxx (Robert Cummings)
- Date: Thu, 29 Nov 2007 11:52:57 -0500
On Thu, 2007-11-29 at 16:49 +0000, Stut wrote:
Robert Cummings wrote:
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.
That's a runtime definition. It has to be. The function_exists function
*cannot* be "run" at compile-time to see what the result is, so it must
happen at runtime.
Bleh, just read your comments and then read the comment I quoted and I
find myself needing a morning wakeup slap :) Your comment at the top
says compile-time, not run-time. I'm going to go find a big rock *hehe*.
Cheers,
Rob.
--
............................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
............................................................
.
- References:
- Structured Code vs. Performance
- From: news_yodpeirs
- Re: [PHP] Structured Code vs. Performance
- From: Jochem Maas
- Re: [PHP] Structured Code vs. Performance
- From: Stut
- Re: [PHP] Structured Code vs. Performance
- From: Jochem Maas
- Re: [PHP] Structured Code vs. Performance
- From: Stut
- Re: [PHP] Structured Code vs. Performance
- From: Robert Cummings
- Re: [PHP] Structured Code vs. Performance
- From: Stut
- Structured Code vs. Performance
- Prev by Date: Re: [PHP] Structured Code vs. Performance
- Next by Date: Re: [PHP] Dynamic Display of Images Stored in DB
- Previous by thread: Re: [PHP] Structured Code vs. Performance
- Next by thread: Re: Structured Code vs. Performance
- Index(es):