Is there any automation tool for converting a php 5.4 script back to 5.3? Mostly there are new style arrays causing problems.
This:
<?php
$x = [1, 2, 3];
$y = [
'a' => [1,2],
'b' => 'c',
];
function ff($x = []) { ...}
Should be converted to this:
<?php
$x = array(1, 2, 3);
$y = array(
'a' => array(1,2),
'b' => 'c',
);
function ff($x = array()) { ...}
Other backward compatibility issues are just a few and can be fixed by hand. I'm very bad at language processing, has anyone already done this? the converter doesn't need to be PHP. python, Java, ... are all file (I just prefer python, that's all).
You can use a tool to convert your codebase from PHP 5.4+ to PHP 5.3, such as: http://github.com/endel/php-code-downgrade/
This tool will read all your files and rewrite code using PHP 5.3 standards, even for your composer dependencies.
The ideal scenario is to write code compatible with your production server, but sometimes it is not possible to know it by antecedence, so this tool may do the job for you.
The advantages of using this is that you can write modern code without worrying about legacy PHP version support.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With