Summary and troubleshooting of PHP development problems

Source: Internet
Author: User

In PHP development, question 1: How to Use the ord () and intval () functions in PHP?

The ord () function returns the ASCII value of a character;
For intval (), if the parameter is a string, the integer represented by the first numeric string that is not a digit before the string is returned. If the first string is '-', it starts from the second string.
If the parameter is a number of characters, return the value after the value is rounded up.
Of course, the value returned by intval () is within the range (-2147483648 ~ 2147483647), the value beyond this range will be replaced by the boundary value;
Example:
 

  1. Ord ('A') = 65;
  2. Intval ("A") = 0;
  3. Intval ("1123Asdfka3243") = 1123;
  4. Intval (12.3223) = 12;
  5. Intval ("1213423423459348752347598723498572398475") = 2147483647;
  6. Intval ("-1213423423459348752347598723498572398475") =-2147483648;

PHP development issues 2. Why is assignment in condition warning?

I have used this in the PHP Manual: while ($ data = mysql_fetch_assoc ($ result) prompts an assignment in condition warning. After checking, I finally found that, it turns out that writing is not rigorous and is not a mistake. The solution is as follows:

While ($ row = mysql_fetch_assoc ($ result ))! = False)

So there will be no prompts.

Question in PHP development 3. Is the form submitted on this page?

<Form action = "/index. PHP" method = "post">

The address on this page following the action is shown above,

Or use $ _ SERVER ['php _ SELF '] as follows:

<Form action = '. $ _ SERVER ['php _ SELF']. 'method = "POST">

Question during PHP development 4. What is the output function?

Echo: output variable or character

Print_r: Output Array

Var_dump: returns a Boolean value.

5. What is the problem during PHP development? 5. How does Greenwich Mean Time and format time convert each other?

A) Greenwich Mean Time is converted to the specified format time

  1. /**
  2. * Convert the timestamp to Greenwich Mean Time
  3. *
  4. * We recommend that you use the gmdate/date that comes with PHP.
  5. */
  6. Function UnixToGmt ($ format_string = "Y-m-d H: I: s", $ UnixTime = 0)
  7. {
  8. Return @ gmdate ($ format_string, $ UnixTime );
  9. }

B) What is the Greenwich Mean Time of the current time?

$ D1 = date (mktime () + 28800; // plus the time zone difference of 8 hours

Example:

$ D2 = UnixToGmt ("Y-m-d H: I: s", $ d1); // specify the format time for the current time

Echo $ d2; // output

In PHP development, Question 6: GET the parameters passed by GET?

For example, http: // 127.0.0.1/index. PHP? Id = 3

GET the value of ID: $ _ GET [id]


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.