Does -D php7 supports php 5.6 or 5.5?
-D php7 switches code generation to PHP 7, I haven’t tried it, but I think you will run into problems trying to run PHP 7 code on PHP 5 servers.
You will also have to stay with Haxe 3, because Haxe 4 dropped support for PHP 5 output.
its possible to compile to php7 and php5 from one code base ?
in example i use NativeAssocArray in haxe and compiling to php5 version not work
how i can replace NativeAssocArray to othеr type?
yes, I have done so in the past, but of course there are some differences between the two, that might require some work
I haven’t used NativeAssocArray, but as far as I can see, that one is only available in Haxe 4.
Most of my projectes started as Haxe 3 / PHP 5 so switching to PHP 7 for most parts was just adding
-D php7 (or using Haxe 4 compiler instead of Haxe 3).
If your code relies on having
NativeAssocArray around, I would just implement my own version of it and use it when targeting PHP 5 (the current Haxe 4 implementation of
NativeAssocArray is less than 20 lines of code, so it should be easy to come up with a replacement)
From the PHP lifecycle page:
PHP 5.5 reached end of life in 2016.
5.6 will reach end of life in three months. 7.0 - in 2 months.
After those dates no bugfixes or security updates will be provided for specified PHP versions.
You really should migrate at least to 7.1. Or better yet to 7.2