php converter

coding in PHP codes
Post Reply
User avatar
Jerry
Posts: 3
Joined: Mon Jul 03, 2023 11:35 pm

php converter

Post by Jerry »

how best to convert code from PHP 5 to PHP 7 version?
User avatar
Griffin
Posts: 1
Joined: Tue Jul 04, 2023 11:57 am

Re: php converter

Post by Griffin »

User avatar
solaris
Posts: 3
Joined: Tue Jul 04, 2023 5:18 pm

Re: php converter

Post by solaris »

set up two local servers, one with PHP 5, the other with PHP 7. Set each localhost to connect to another LocalHost with a different PHP version. Write the code in the old php version, so it would be possible to call it in the new php version. This is how you can migrate data step by step.
There are various PHP5 to PHP7 converters, unfortunately they do not give reliable results.
User avatar
penguin
Posts: 1
Joined: Wed Jul 05, 2023 5:57 am

Re: php converter

Post by penguin »

PhpStorm by JetBrains is supposed to translate PHP5 to PHP7. I tried to install PhpStorm in Windows 7. The installation crashed. I don't know if there is a PhpStorm for Linux. The fact that PHP7 is not backward compatible with PHP5 in terms of source TXT commands is quite surprising. If I have a text instruction that invokes a certain translation code in PHP5, then perhaps it is not a problem to either keep it in PHP7, perhaps concurrently with a new instruction that invokes the same code.
Example:

in PHP5 I have

$bobo = $bobo_array["bobo"];
while in PHP7 this does not apply and I should have $bobo = $bobo_array['bobo'];

so PHP7 authors should be able to provide a converter that converts those text lines according to the new rules.

Another absurdity: classes Int, String, Float and Bool are forbidden in PHP7. :D Apparently these are just names. So some converter can rename them in the original PHP5 source from Int to Int5, String to String5, etc. It simply adds the number 5 to the name.
Post Reply