[wp-hackers] readme.txt: "Requires PHP 5 tag"
Otto
otto at ottodestruct.com
Mon Jul 27 13:30:25 UTC 2009
On Sat, Jul 25, 2009 at 3:49 PM, Jordi Canals<jordi at jcanals.net> wrote:
> 2009/7/25 Jason Webster <jason at intraffic.net>
>
>> On 20/07/2009 6:20 AM, Otto wrote:
>>
>> That will run fine. PHP only will throw an error if it actually makes
>>> it to the code. Code is interpreted at the time of execution, not at
>>> the time of inclusion. You can include a file with complete gibberish
>>> inside a function, but until you try to use that function, it won't
>>> stop the program.
>>>
>>> -Otto
>>>
>>
>> That is SO not true.
Fine, let me rephrase.
As long as it is syntactically valid code, the parser won't throw up
on it when turning it into bytecode. It doesn't have to be actual
executable code, just valid enough that it can be parsed as PHP code.
So your example won't work because the code is not correct syntax. On
the other hand, this:
test.php:
<?php
function complete_gibberish() {
this_is_complete_gibberish($full_of_all_sorts_of_errors);
}
echo 'hi';
Works just fine. Even though it's calling an undefined function inside
that function.
Thus, having PHP 5 only code inside the file is fine, as it's got to
be syntactically valid anyway. Having it in a separate file that you
include is overkill.
-Otto
More information about the wp-hackers
mailing list