PHP and MySQL make Dynamic web development experience

Source: Internet
Author: User
Tags manual php and php and mysql

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();
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.