[wp-hackers] readme.txt: "Requires PHP 5 tag"

Chris Jean gaarai at gaarai.com
Mon Jul 27 15:43:48 UTC 2009


PHP 5 does add new keywords. So, if you use keywords that don't exist in
PHP 4, the code will fail to compile even if it doesn't execute.

A few examples of keywords that don't exist in PHP 4 are try, catch,
public, goto, clone, instanceof, and namespace. You can find a full list
of keywords and their versions at http://bit.ly/EaCSz

If you aren't testing for PHP 4 compatibility and want to use fallback
errors as talked about, don't use any of the PHP 5+ keywords in any
files that are loaded.

Chris Jean
http://gaarai.com/
http://wp-roadmap.com/
http://dnsyogi.com/



Otto wrote:
> 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
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>   


More information about the wp-hackers mailing list