Home > Article > Backend Development > How to format code in phpstorm
This article mainly introduces the PhpStorm code formatting settings, which has certain reference value. Now I share it with you. Friends in need can refer to it
PhpStorm The default shortcut key for formatting is Ctrl Alt F, but some formatting effects need to be set by yourself. For example, if you want the PHP code to be aligned with equal signs during formatting, you need to configure it yourself. First open phpstorm and find Setting/Editor/Code Style/PHP as shown below:
(Scheme Select Default to set the IDE. If you select Project, it is only for the current Project is valid)
1. Set equal sign alignment Select Wrapping and Braces, check Align consecutive assignments and Align Key-Values Pairs, as shown in the figure:
2. Automatically convert array() to [] Select Code Conversion, check Force short declaration style and Add a comma ater last element in multiline array, as shown in the figure :
The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
PHPstrom installation and use tutorial
php how to implement random numbers and letters verification code code
The above is the detailed content of How to format code in phpstorm. For more information, please follow other related articles on the PHP Chinese website!