The syntax coloring definition for PHP in Xcode (as of 5.0) is pretty poor:
- probably some 30% of PHP keywords are missing from the definition and are not highlighted as such
- PHP blocks in the middle of HTML tags, also within
<style>blocks are not recognized
- a big drawback for those who code with the short open tags, XCode doesn't support them (
<?=, in fact the latter is enabled irrespective of the short_open_tag setting as of PHP 5.4)
- there is a strange glitch with PHP blocks in the form
<?php ...with a single space after the opening tag: the token immediately after the space is not recognized as a PHP token unless you either add one more space or instead insert a new line
I made some modifications to the corresponding xclangspec files (which should be applied after each upgrade to XCode) that solve some of the problems above, but not all. I couldn't make it recognise my PHP insertions within
<style>, plus I couldn't solve the single space glitch problem. Also, for some reason my modifications work slightly better when you mark your PHP files as HTML.
Obviously, short open tags can't be used in XML files, so I didn't even touch the XML syntax definitions, just PHP and HTML.
Answer: (since the question was closed): my patch that solves some of the problems above: https://github.com/crontab/xcode-php-patch