I. 10 Experiences
1. Do not rely on register_global=on environment, from you just know how to configure PHP to run the environment not even understand Register_global On/off will have any impact on their own day, you should be brave to set it off.
2. See how to use error_reporting before writing a program.
3. It's right to ask if you don't know, but you need to check the manual before that.
4. Of course, you need to know how to use the manual. When the manual does not find the answer, you should consider the search engine on the web.
5. Just learn to Php+mysql, do not shout to write a forum, to write xxx. To understand that just learning to write Chinese characters does not mean that you are capable of writing poetry.
6. When learning Web programming, you should first get to know the HTML friend.
7. After a bit of ability, try to answer the novice question, do not see oneself understand and others do not understand complacent, throw down a "simple, that is the basic thing" to go more must not.
8. Thinking is a good habit, do not write is tantamount to fantasy, nothing.
9. Write a program, if you feel very satisfied, after a week to see again, perhaps you will think it should be changed
10. Have a free time to look at other people's procedures, find out the shortcomings or advantages of others, their own weigh.
Two. What to do
1. Good at using "references", it can directly affect the efficiency of the program.
2. Good at using ternary operators, you can make the program more streamlined and efficient.
Like what:
if ($data[$i][’nickname’])
{
$nickname = $data[$i][’nickname’];
}
else
{
$nickname = $data[$i][’ip’];
}
Can be written as:
$nickname = $data [$i] [' nickname ']? $data [$i] [' nickname ']: $data [$i] [' IP '];
3. Good at organizing if...else ...
Like what:
$ext_name = strtolower(str_replace(".", "", strrchr($upfilename, ".")));
if (!empty($type))
{
if (!strpos($type, $ext_name))
{
echo "Please upload the file of $type form.";
exit();
}
}
The code above should be written like this:
$ext_name = strtolower(str_replace(".", "", strrchr($upfilename, ".")));
if (!($type===’’) && strpos($type, $ext_name)===false)
{
echo "Please upload the file of $type form.";
exit();
}