PHP version compatibility check

后端 未结 3 1115
北恋
北恋 2021-02-06 05:33

How do I know my code which version of the language is compatible? Is there a way to figure out which is the minimum version of PHP language that can execute it without error? M

3条回答
  •  后悔当初
    2021-02-06 06:00

    Most likely you need to have different PHP versions installed. Then you can check compatibility of your code with specified PHP version using shell:

    find . -name *.php | xargs -n1 /usr/bin/php -l
    

    php -l command runs PHP in syntax check only mode. The command above will check each PHP file in your project againts compatibility with PHP version located at /usr/bin/php.

提交回复
热议问题