How can I guard my code so I can run the same program on PHP 5 and 7. For example in php 7 I can do $x = $x ?? 'true';
In php 5 I have to do $x = $x ? null : 'true';
I have tried using PHP_MAJOR_VERSION but when I put the ?? in the php 7 only if/else I get a Parser Error. It seems that there must be a way to guard certain areas of the code so it can be run on either php 5 or 7.
There is 1 reply in this thread, which is not being displayed. Browsing this forum thread replies is available only to premium subscribers.
Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.