Article
2 Quick PHP Tips
Page: 1 2
Bonus Tip!
Getting Syntax Highlighting for PHP with Dreamweaver 4
As I was programming in PHP using Dreamweaver 4 as my text editor, I came across a handy little trick. You can fool Dreamweaver into thinking that code on the page is JavaScript, so that it applies the same syntax highlighting rules to your PHP as it would to JavaScript.
JavaScript and PHP both draw from the same languages, including C and Java, and therefore have many aspects in common. Try it out and see for yourself. Add this code to the top of a PHP document, open it in Dreamweaver 4, and go to the text editor (you can click Ctrl-Tab on your keyboard to switch views):
/* >The code to get PHP syntax highlighting with Dreamweaver
<script language="JavaScript"> (courtesy of david@superupdate.com) */
What the code does is close out the most recent left bracket on the page (typically from <?php) and sets the script language to JavaScript for the remainder of the page. The code itself doesn’t affect PHP because it is commented out using the /*…*/ commenting system.
I hope these little PHP coding tips make your development time more efficient, and your resulting code more effective!