7

Is there a converter to convert PHP code from a higher version (e.g. dropdown-select PHP 5.7) to a lower version (e.g. dropdown-select PHP 5.2)?

This would extremely useful for compatibility with existing legacy systems. It must be able to convert PHP 5.3's anonymous functions into the equivalent PHP 5.2's string-based versions using create_function. (Indeed that's the only feature I need actually.)

Of course, support for the additional features would be great too, e.g.:

A standalone converter (runnable at least on Windows) would be sufficient, though preferably an option to plugin-integrate with Notepad++ and possibly PHP Storm. (E.g. whenever I save a file e.g. my_file.php.pre, it would automatically do the conversions and output my_file.php.)

  • (Meta discussion about this question.) – unor Apr 1 '15 at 2:11
  • 1
    Must the tool be a PHP script/app as well? If so: which PHP versions must it be capable running under? If not: what OS must be supported – or must it be cross-platform? Though "Notepad++" indicates a Windows environment, please specify this explicitely – including conditions (e.g. "(fully) automated tool prefered to run on the Linux server; for manual run, preferably on the Windows workstation with, if possible, Notepad++ integration"). Not that I'd know an answer – but I'm pretty curious for it. Interesting question, +1 from me meanwhile in advance to your edit :) – Izzy Apr 1 '15 at 7:02
  • 3
    @Pacerier is this any use? github.com/endel/php-code-downgrade - I'm not majorly familiar with PHP so not completely sure if it would help... – CalvT Apr 1 '15 at 11:23
  • @Izzy, Yes I'm on Windows, have edited the question to include the specifics. The tool doesn't need to be coded in PHP. – Pacerier Apr 1 '15 at 20:33
  • 3
    @CalvT, Yes, something like that. However that only provides a 5.4 to 5.3 converter, so it doesn't have the capability to convert anonymous functions (introduced in 5.3) to create_function. – Pacerier Apr 1 '15 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.