Vim Tips Wiki

Use this page to discuss script 1571 php: PHP syntax

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on
  • This page may be out of date: check the script's page above, and its release notes.


I have v0.9.7 installed, and seems it gets out of sync when function header includes comment in a class:

class foobar {
    public function /* array */ blah($id)
        echo ("foo");

Another bug in v0.9.7, the following code incorrectly shows error highlighting:

 while ($row) {

  <a href="./events/events.php?eventId=<?=$eventId?>"><img src="<?=$imageBanner?>" style="border:1px solid #000;" alt="<?$title?>"></a><br>

<? } ?>

I've noticed another bug where the syntax highlighting will disable itself until you scroll to the top of the file again

<script type="text/javascript">
var x = '<?php echo 'hello' ?>';

// Pad the file with empty comments

Open a new split and switch to the new buffer while the top of the file is off the screen and the highlighting will change. Switch back to the file and scroll up and it'll be re-applied.