Basic knowledge of PHP notes

Source: Internet
Author: User

There are several types of PHP
How the various types of PHP are converted
PHP input and output mode
PHP Type: 4 kinds of scalar types Int,float,string,bool
2 types of composite Array object
2 special types of resource null
PHP has no underfined
The variable name of PHP is case-sensitive, but the function name is case-insensitive
Define attributes within a class to use Var
echo "


Echo
"Source Output

Echo can only be used to output 4 scalar types
Var_dump can output both the value of a variable and the type of the variable

isset– detect whether a variable exists
Strlen: Output string length –strlen (year) Here the year is a string

A stateful representation is connected to the server without delay.
No status indicates that a refresh is required to connect
HTTP protocol is stateless
MD5 ($string): MD5 encryption.

PHP Data Entry (get/post)
HTTP four keywords (get post put delete)
Get: The data is transmitted through the URL--http://localhost/day1/1.php?name=laoshan is the got commit.
$_get to receive

< form action= ' 1.php '/(where action is submitted to WHO to process)/method= ' post ' (transmit data by post method) >
A function inside has return call functions, no return call process.

PHP does not have the var keyword to define variables, with $
Three-yard consistency: file encoding, Browser coding, Database coding
File encoding: ANSI (single-byte), Unicode (double-byte), database encoding
Browser encoding: gbk/gb2312/gb18030 utf-8
Database encoding: The front piece is written in utf8, without a dash.

Base64_encode (data) Base64 encoding Base64decode (data) to string for Base64 encoding Base64_decode (data) Base64 decoding string

String-cutting –explode (delimiter, delimiter,string). This function returns an array of strings, each of which is a substring of string, which is split by delimiter as a boundary point.

Strlen (String): Represents the length of a string, count (String): Represents the length of a string (arr): Represents the length of an array

colspan: Merging columns Print_r: output array

Is_numeric ($num): Determine whether NUM is a number

' Variable '-direct output ' variable '-converted to value output

Unset can destroy scalar types and compound types directly
Intval casts other types to int
Settype ($num, int) converts other types to int

Serialization and deserialization
String->object unserialize ();
Object->string serialize ();

String–>array Loop and then each push into the array.
Array–>string loops The string, actually the same as above

Explode is equivalent to substr in JavaScript, used to cut strings
To find the string length with strlen ();

for (indexed array) foreach (associative array) while-each-list
foreach (variable name as key name => key value)
foreach (variable name as key value)

The difference between varchar (8) and char (8) in a database, varchar is indefinite, char is fixed, such as Laoshan is seven bytes long, varchar storage is seven bytes long, but char is eight bytes long, but varchar is slower , change space with time
Primary key cannot be empty, and self-growing
Null+1 cannot be computed in the database, which is not equal to 1
Introduce with include or require
Single quotes inside the output is a string, double quotes inside the output is the value
Statement from the top down is for inclusion said, the browser to execute the header, and then execute the package body

< PHP?>
The php.ini of 1.apache translated this sentence into

2. Be put into the package body to return Chorme
3.chorme executed script> (alert (123))
And not in PHP, only execute 2,3

Select is not the same as insert,update, even if not found will return an empty result set, so this should determine whether to get the array, you should use Mysqli_fetch_array to handle query

Enter an address in the address bar and what happens after the carriage return
The client sends a request to the server side, which has a software server, which is responsible for receiving, then calls the PHP module, launches, parses the PHP syntax, operates, displays the results, and responds back to the browser
DNS: Dynamic Domain name resolution

First class, then construct object based on class

The ID is for the front end, and name is for the backend to look at

Not to be continued ...

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.