Re: Idea: ifdef-like feature to ease userland BC
| From: | Rouven Weßling | Date: | Sat, 08 Mar 2014 21:58:35 +0000 |
| Subject: | Re: Idea: ifdef-like feature to ease userland BC | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-73011@lists.php.net to get a copy of this message | ||
On 08.03.2014, at 22:48, Marco Schuster <marco+php@m-s-d.eu> wrote:
> $var=[];, traits or similar
Neither of these is something you'd really do a version switch around, as it would lead to a
lot of duplicated code, that needs to be kept in sync. Of the top of my head there are three
situations where branching based on the PHP version is necessary/useful:
1. I'm using an API which is deprecated/unavailable in the newer version I support but the
replacement is not available in the older version.
2. I can improve performance, security or functionality by using some new native function that is
not available in the newer version. (For example hex2bin only being available in PHP >= 5.4)
3. Working around bugs in specific PHP versions.
It would be incredibly unlikely for any of these to involve recently improved syntax. Also note that
from what I'm understanding the OPCache Optimizer will actually remove some branches which
can't be called, so there's some chance that there will be no runtime performance impact
at all by these checks.
Best regards
Rouven