Re: Idea: ifdef-like feature to ease userland BC
| From: | Arvids Godjuks | Date: | Sat, 08 Mar 2014 23:00:13 +0000 |
| Subject: | Re: Idea: ifdef-like feature to ease userland BC | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-73013@lists.php.net to get a copy of this message | ||
2014-03-08 23:34 GMT+02:00 Marco Schuster <marco@m-s-d.eu>:
> Hi Internals,
>
> especially with (radical) userland API changes coming up in PHP6,
> might I suggest something like a ifdef feature which turns blocks of
> code into comments?
> This would allow framework authors to provide backwards compatibility
> with "older" PHP versions while being able to take advantage of new
> PHP features.
> In theory, it could also be supplied as "update" to the already
> existing minor versions (5.4,5.5 and 5.6) so that these versions can
> also use the new code.
>
> Marco
Hello Marco.
This really sounds strange. Why? Because you already have all the tools in
userland to do all that since like PHP 4.
You have "function_exists"
http://lv.php.net/manual/en/function.function-exists.php
, you have
"phpversion" http://lv.php.net/manual/en/function.phpversion.php,
you have
PHP_VERSION_ID constant (details about the constant are in
http://lv.php.net/manual/en/function.phpversion.php
too), you have
version_compare http://lv.php.net/manual/en/function.version-compare.php
Sometimes you just need to look up the actual manual...
Arvids.