Skip to content
Advertisement

How can I set the PHP version in PHPStorm?

Is it possible to set the PHP version value, say 4.0+ and have PHPStorm highlight functions that wouldn’t work with the oldest version? For example, for PHP4 this should highlight static function etc. I have a PHP installation on my PC but I don’t want to install an older PHP version for every small script I have to produce.

Thanks

Advertisement

Answer

So, you mean to highlight all pieces of code that will not work with the PHP version you are writing it in, right? That can be done here:

Preferences -> Languages & Frameworks > PHP

and the same on Mac:

PhpStorm -> Preferences (⌘,) -> Languages & Frameworks > PHP

Or with newer versions of PhpStorm in Windows:

File -> Settings -> Languages & Frameworks > PHP

Sample dialogbox for mentioned prefrences

then select your PHP version, for example, 7.0

This is very useful when your local system runs PHP 7.0, for example, but production is running PHP 5.5.

That way PhpStorm will warn you which parts will not work in production, show proper hints during writing code according to the selected version, etc.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement