Home >Backend Development >PHP Tutorial >Summary and troubleshooting of problems in PHP development_PHP tutorial

Summary and troubleshooting of problems in PHP development_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:32:23888browse

Questions in PHP development 1. How to use ord() and intval() functions in PHP?

The ord() function returns the ASCII code value of a character;
For intval(), if the parameter is a string, it returns the character before the first character in the string that is not a number. The integer value represented by the numeric string. If the first character in the string is ‘-’, counting starts from the second character.
If the parameter is a dotted number, its rounded value is returned.
Of course, the value returned by intval() is within the range that can be represented by a 4-byte range (-2147483648~2147483647). Values ​​exceeding this range will be replaced by boundary values;
For example:

  1. ord('A')=65;
  2. intval("A")=0;
  3. intval("1123Asdfka3243")=1123;
  4. intval(12.3223)=12; intval("1213423423459348752347598723498572398475")=2147483647; 2398475")=-2147483648;
  5. Problem 2 in PHP development. What is the reason for the assignment in condition warning?
  6. This is used in the PHP manual: while ($data = mysql_fetch_assoc($result)) The result was an assignment in condition warning. After inspection, I finally found out that it turned out to be a loose writing method. It's not a mistake. The solution is as follows:

while (($row = mysql_fetch_assoc($result)) != false)

This way there will be no prompts

PHP development Question 3. Form submission to this page?

action followed by the address of this page is as above,

or use $_SERVER['PHP_SELF'] is as follows

Problems in PHP development 4. Print output content function?

echo: Output variables or characters

print_r: Output array

var_dump: Output Boolean value

Problem 5 in PHP development . Convert between Greenwich Mean Time and formatted time?

a) Convert Greenwich Mean Time to specified format time

/**

    * Convert timestamp to Greenwich Mean Time
  1. *
  2. * It is recommended to use the gmdate / date that comes with PHP
  3. */
  4. function UnixToGmt($
  5. format_string
  6. =
  7. "Y-m-d H:i: s" ,$UnixTime = 0) { return @gmdate($format_string,$UnixTime);
  8. }
  9. b) What is the Greenwich Mean Time of the current time?
  10. $d1 = date(mktime()) + 28800; //Add the time zone difference of 8 hours
  11. Example:

$d2 = UnixToGmt("Y-m-d H:i :s", $d1); //The current time specifies the format time

echo $d2; //Output

Question 6 in PHP development, get the parameters passed by GET?

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

Get the value of ID: $_GET[id]

http://www.bkjia.com/PHPjc/446136.html

www.bkjia.com


true

http: //www.bkjia.com/PHPjc/446136.html

Questions in PHP development 1. How to use ord() and intval() functions in PHP? The ord() function returns the ASCII code value of a character; for intval(), if the parameter is a string, the first one in the string is returned...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn