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

Shane A. Froebel shane at bugssite.org
Mon Jul 27 13:41:14 UTC 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just to make it clear (from
http://us2.php.net/manual/en/function.version-compare.php)

if (version_compare(PHP_VERSION, '5.0.0', '>')) {
    echo 'I am using PHP 5, my version: ' . PHP_VERSION . "\n";
}

if (version_compare(PHP_VERSION, '5.0.0', '<')) {
    echo 'I am using PHP 4, my version: ' . PHP_VERSION . "\n";
}

Jordi Canals 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.
>>
>> test.php:
>> <?php
>>
>> function complete_gibberish() {
>>    this is complete gibberish
>>    full of all sorts of syntax errors
>> }
>>
>>
>> echo 'hi';
>>
>>
>> $: php test.php
>>> PHP Parse error:  syntax error, unexpected T_STRING in
>> /home/jason/test.php on line 4
>>
>>
>>From PHP-4, the file is parsed when loaded, so syntax in all file is checked
> as soon as the file has been included. It does not mind if the code is
> executed or not, Steps are like that: 1) File is loaded, 2) File is parsed
> and compiled and 3) The code is executed.
> 
> So, the best way is to have a small file to check for the version prior to
> including any version specific version code, you can do with a file like
> that:
> 
> <?php
> if ( version_compare(PHP_VERSION, '5.0.0', '<') {
>    die ( "PHP 5 is required to run this script");
> } else {
>    include 'filename.php';
> }
> ?>
> 
> Regards,
> ---
> 
> Jordi Canals
> http://alkivia.org
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
> 


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJKba55AAoJEC7/vS6gbNwFvwMP/jjv/8M/B+cucjbDT1UDuHdX
H93bUvhTVHD0te3I3+WjGw8mjDRh7gpgXhvXfwEwFBjcDE6e5lUnozL4IB+pKP7+
Dw0Cw6TuzSK4Be0wC1P1BAXl/chhE1QiHuXC+LJojqxVuOTlX8Eso/dRMQh1MpuT
gvwDwOS2q9LbgzAJA4YjnvaSZO9sjVAgA4t7igvSaJ/n8Wylby+f3U5Tc9BMzCXA
ONCu5G6Qk9ab7/buq9c1fa9o+Q8WG2nzr4FUEIW4RUOwtCEmO7IJRTCpaVlvK1az
acJJ+aBatHsQE1PpPsTBTlHfsMdhrnzHaI98AWYzJjkpwwefa2Q6Koie6paew8l/
5wy2AcM8Zw/ADE3cFwyVnFNbGvgK3ZDdDuvQxoU26hcm9zEpMu6t3X6a7NtNssC6
UeJnEtfNp0LriH/CUEnFgjp3QYnDSfAYmVJg5nys0DRijyV1MCg2yepzAlDeoWk/
5MuFzjPjVqvVnjGcCGY3ym+Xu2BeKAOblnFflP+4RBK5eHpuAiNUvWPR/gL+xC8s
dcIZCxPjHjTCMJkrzll67Ur9hTPZl2hZxZbIlri6ZIasTw3q/x/1j8AxRKagvRPz
3hQI6GN0GtJ+VMg9aS9ka89CxbAXfJWvnSBairU6bEYOuDUQJ99KHI0Lmu608Ey3
2jc98Y91hOwfRmZ09l6U
=O0zC
-----END PGP SIGNATURE-----


More information about the wp-hackers mailing list