Recent PHP web apps like Drupal and frameworks like symfony recommend you not close the PHP tag in a PHP script. (In templates you need to open and close PHP tags a lot, of course.)
TextMate PHP Bundle comes with the following snippet with “Tab Trigger” as “php”. Inside an HTML scope, it works as <?php $0 ?> and inside in PHP scope, it works as ?>$0<?php.
When I write a PHP script, I open a blank document and set the language to “HTML”. (TextMate recommends that you use “HTML” instead of “PHP”.) Because I do not want to close the PHP tag, I only want to insert <?php.
In order to do so, I made the following snippets. The snippet itself is simple:
<?php
Set “Activation” to “Tab Trigger” “ph” and set “Scope Selector” to “text.html”. By using “ph” rather than “php”, you don’t see any conflict when you use the snippet.