PHP Error Collation

Source: Internet
Author: User

SQL statement: Select Code as ' code name ' from users;

Print_r () in PHP is a printed array. Var_dump () Output Variable type

PHP in double quotes inside can parse variables, single quotes can not parse escape character

$x = 1; + + $x;  $y = $x + +; Executive $y

PHP substr () can intercept the string strlen () to take the length of the string str_replace () find replace the explode () function to break the string into arrays.

Exit () and Die () equivalent exit () function outputs a message and exits the current script.

<?php

$nextweek =time () + (7*24*60*60);

Echo ' Now: '. Date (' y-m-d '). " \ n ";

Echo ' Next Week: '. Date (' y-m-d ', $nexWeek). " \ n ";

?>

Get today's date with next week's date

A static member is a class, and a normal member belongs to an object.

Define functions: Function Show ($a =1, $b) {}

Add John to the users array

$users []= "John";

Array_push ($users, "John");

$users ["AA"]= "John";

The @ symbol can block hints

10/4=2.5 because PHP is a weakly typed language

$attr =array (1,2,3,4);

while (list ($key, $value) = each ($attr))

{

echo $key. " = ". $value." <br> ";

}

while (list ($key, $value) = each ($attr))

{

echo $key. " = ". $value." <br> ";

}

How many rows of data will be output!

The each () function returns the key name and key value of the current element and moves the internal pointer forward.

The key name and key value of the element are returned in an array with four elements. Two elements (1 and value) contain key values, and two elements (0 and key) contain key names.

No data is executed, so the second while does not execute 4 rows of data.

$attr represents an array, the length of the array can be obtained by using count

PHP Error Collation

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.