Please see my article about the Syntastic Vim Plugin for a better way of syntax checking in VIM.
I find it really helpful to be able to test for syntax errors from within VIM. VIM offers this option via filetype plugins and the :make command. To enable this functionality 2 small config changes are necessary.
# Map the make command to CTRL+t map <C-T> :w<CR>:make <CR>
# Set the make command to execute the PHP syntax checker set makeprg=php\ -l\ % # Update error formatting set errorformat=%m\ in\ %f\ on\ line\ %l
This will only change the make command for .php files and keep other files unaffected.
Once you changed those 2 files you can hit CTRL+t and you will see if you have any syntax errors in your code:
PHP Parse error: syntax error, unexpected ';' in test.php on line 3 Errors parsing test.php
Note: Executing the syntax test will save the file before testing.