PHP is an efficient network programming language. It is a preferred language for Web programmers because of its flexible programming and fast running. So how can we become a good PHP developer?
It is not easy to become a PHP programming expert, as many people think, as long as you can quickly write a few simple code to solve a complicated problem, that is, a PHP programming expert, real PHP experts also need to consider more other issues. The following three principles should be followed by a mature PHP programmer in programming.
◆ Laziness is gold
◆ Write beautiful code
◆ The pursuit of program speed, rather than programming speed
Laziness is gold
Be a lazy programmer? This is a strange idea! This is because the busiest person in the world may be a computer programmer. But it is because programmers are too busy that they should learn to be lazy during programming. For a programmer, there are two lazy methods:
First, use the code of someone else to integrate the code into your own program or project. The second is to write some useful code to create a function library, which can be easily written in the future, saving a lot of repetitive work, so you can naturally be a little lazy. Both of these methods are very suitable for PHP programmers.
First of all, PHP is a language born and grown in a free and open environment. There are thousands of programmers around the world who are constantly striving for PHP perfection and are willing to share their talents and code with others. Every day, you can find a lot of excellent program code from some PHP websites, email lists, and newsgroups.
In this way, I do not encourage you to wait all day for others to write code for you, but you can "stand on the shoulders of great people" and fully carry forward "ism ", smart Application of others' program code can save you a lot of time. Second, in PHP, you can easily create your own function library, which saves you a lot of trouble when writing programs later.
Below I will introduce several common functions, some of which come from some open source projects on the Internet and some of which are selected from the mail list. If you can add them to your own function library, sooner or later you will find yourself benefiting.
1. Common Database processing functions
Compared with other CGI functions, one of the advantages of PHP is its powerful database processing capability. However, in PHP, some specific functions are used for different databases for special processing, and common database processing functions are missing. This greatly reduces the portability of program code, which also brings a lot of inconvenience to beginners.
On the Internet, many programmers solve this problem through encapsulation. They have compiled unified functions to deal with any popular databases-Mysql, which is popular in the Linux World, and SqlServer, which is widely used on Windows platforms.
I personally like to use these functions, because some simple functions such as "query" and "next_record" can be used directly, you do not need to consider the complex things such as database connection and database handle, and do not need to consider what type of database is used. If you need these functions, you can access the following urls:
Http://phplib.netuse.de/
◆ Http://phpclasses.UpperDesign.com/browse.html/package/20
Http://phpdb.linuxbox.com/