How To : Improve Your PHP Programming 如何提高你的PHP编写水平
中文版 转自 落伍
Hello everyone,
I’ve decided that I would make a thread here describing the different things that I do to improve other people’s PHP scripts.
Hope you enjoy it and learn a thing or two.
1 – Your PHP Tags
I know some of you prefer to use the short tags when writing PHP scripts but this is not always the best way of doing it.
The standard tags are much better as they will work on every server that you write your PHP code on. You may move to a server some day that doesn’t allow the short tags or the ASP-style tags and you will have to sit for an hour and update your PHP scripts.
2 – Debugging Your PHP Code
Some of us may run into a problem when programming a PHP script and don’t know what’s wrong with it. The error_reporting() function in PHP helps you out by telling every error you have on your page. To show all of the errors on the page that you’re editing, put this on the second line :
CODE: [Copy to clipboard]
PHP:
How To : Improve Your PHP Programming 如何提高你的PHP编写水平