Opening and closing PHP tags faster in templates

In Zend Studio when you are outside of a PHP block and type "<?" (and nothing more, it works immediately after typing the "?") it gets converted to "<?php ?>" (and with the cursor before the second "?").
This is really really useful when you are writting your templates views.

Is possible to do the same with PHPStorm?

Thanks !

Comment actions Permalink

Hi Enrique,

There is no built-in functionality to do exactly that. But you can use Live Templates (Settings | Live Templates) to implement this -- create one so when you type <?[TAB], it will be replaced by <?php ?>. (By [TAB] I mean pressing Tab key or whatever other "expand" button you have chosen). Works fine for me -- no issues at all:

Abbreviation: <?
Description: Whatever you like
Template text: <?php $END$ ?>
Applicable in: PHP

Comment actions Permalink

Thanks Andriy !
I've choosen the <?[SPACE]

Comment actions Permalink


Please submit a feature request for your case -

Thank you for feedback!


Please sign in to leave a comment.