Basic knowledge of PHP Learning Summary

Source: Internet
Author: User

Start over today. Basic knowledge of PHP refueling address: http://www.runoob.com/php/php-operators.html: PHP operator

May 23, 2017 23:38:30

Notes:

  

PHP Basics
May 23, 2017 23:38:41
1.PHP is a powerful server-side scripting language for creating dynamic, interactive sites.
2.PHP is the server-side scripting language.
3.PHP (full name: Php:hypertext preprocessor, or "PHP: Hypertext Preprocessor") is a common open source scripting language.
The PHP script executes on the server.
PHP is free to download and use.
4.PHP files can contain text, HTML, JavaScript code, and PHP code
PHP code executes on the server and results are returned to the browser in plain HTML
The default file name extension for PHP files is ". php"
5.PHP can generate dynamic page content
PHP can create, open, read, write, and close files on the server
PHP can collect form data
PHP can send and receive cookies
PHP can add, delete, and modify data in your database
PHP can restrict users from accessing some pages on your site
PHP can encrypt data
6.PHP can be run on different platforms (Windows, Linux, Unix, Mac OS X, etc.)
PHP is compatible with almost all servers currently in use (Apache, IIS, etc.)
PHP provides a wide range of database support
PHP is free and can be downloaded from the official PHP resources: www.php.net
PHP is easy to learn and runs efficiently on the server side
7. Because PHP is free, most WEB hosts provide support for PHP.
8. IDE:
Eclipse for PHP (free) address: HTTP://WWW.ECLIPSE.ORG/DOWNLOADS/PACKAGES/ECLIPSE-PHP-DEVELOPERS/HELIOSR
Phpstorm (charge) Address: http://www.jetbrains.com/phpstorm/download/
The 9.PHP script executes on the server and then sends the plain HTML results back to the browser.
A 10.PHP script can be placed anywhere in the document.
1.PHP files usually contain HTML tags and some PHP script code.
Each line of code in 2.PHP must end with a semicolon. A semicolon is a delimiter used to differentiate the instruction set.
3. With PHP, there are two basic instructions for outputting text in the browser: Echo and print.
4. Variables are "containers" for storing information
5.PHP Variable rules:
The variable starts with the $ sign, followed by the name of the variable
Variable names must start with a letter or underscore character
Variable names can contain only alphanumeric characters and underscores (A-Z, 0-9, and _)
Variable names cannot contain spaces
Variable names are case-sensitive ($y and $Y are two different variables)
Both the 6.PHP statement and the PHP variable are case-sensitive.
7.PHP no command to declare a variable.
8.PHP is a weakly typed language, because variables in PHP are not declared to be used directly.
9. To invoke a global variable defined outside a function within a function, we need to add the global keyword before the variable in the function:
10.PHP stores all global variables in an array named $GLOBALS [index]. Index holds the name of the variable. This array can be accessed inside the function, or it can be used to update global variables directly.
1. When a function is complete, all its variables are usually deleted. However, there are times when you want a local variable not to be deleted.
To do this, use the static keyword when you declare a variable for the first time:
2. Parameter scope
A parameter is a local variable that passes a value to a function by calling code.
Parameters are declared in the parameter list as part of the function declaration:
3.echo and Print differences: both Echo and print are language constructs in PHP
echo-can output one or more strings
Print-allows only one string to be output, with a total return value of 1
Tip: The echo output is faster than print, ECHO has no return value, and print has a return value of 1.
4. Data type: String (String), Integer (int), float (floating point), Boolean (Boolean), Array (array), Object (objects), null (null value).
5. An array can store multiple values in a variable.
6.PHP objects
Object data types can also be used to store data.
In PHP, the object must be declared.
First, you must declare the class object using the Class keyword. A class is a structure that can contain properties and methods.
Then we define the data type in the class and then use the data type in the instantiated class: 7,
7. When a constant value is defined, it cannot be changed anywhere else in the script.
8. Set the constants, using the Define () function, the function syntax is as follows:
BOOL Define (String $name, mixed $value [, bool $case _insensitive = false])
9. After the constants are defined, the default is global variables that can be used anywhere in the entire running script.
10. String variables are used to store and manipulate text.
1. In PHP, there is only one string operator.
The collocated operator (.) is used to concatenate two string values together. That is, a connection between a string and a string.
The 2.strlen () function returns the length (number of characters) of the string.
The 3.strpos () function is used to find a character or a specified text within a string.
If a match is found in the string, the function returns the first matching character position. Returns FALSE if no match is found

Basic knowledge of PHP Learning Summary

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.