PHP Learning-7-16

Source: Internet
Author: User
Tags type null

1, the Web, to configure DNS, the domain name translated into an address;

URL: Protocol (HTTP), host (IP), port (80 default), Content php/page (HTML, css,javascript), parameters? id&age=10. 2, the Web principle of Dynamic Web site analysis, request Download/php.rar, Apache do not know the download, find PHP parser, Java Virtual machine. 3. Mainstream Web application platform, ASP (Microsoft announces obsolete, IIS Server, sql,asp), PHP (lamp is completely free). Unix (Oracle,jsp,javaee Strong). 4, the advantages and disadvantages of each platform,, 5, PHP installation, Wampserv (said to install the integration kit, dish is the dish) Linux (source package, RPM package, integration package), Windows (Single, integrated) 6, www.localhost, enter the WWW root directory, You can build files, apps into databases and PHP, and so on, you can manipulate databases and things like that. 7, after the revision of PHP and Apache to restart Apache (PHP is an extension). 8, server-side execution embedded scripting language, open source, can create images, support a large number of databases, 9, syntax <?php?> with this.   <script language= "php" &GT;&LT;SCRIPT&GT;&LT;? ? ><%%>/** **/documentation notes, which can be extracted using software to form a document/** comments must be written on the top or right of the code. **/10, declaring variables, $name = "", starting with $, meaningful, variable names are strictly case-sensitive (other in PHP is not case-sensitive), hump named 11, the judgment variable is not in the isset (), empty to determine whether the variable name is empty, The result returns BOOLEAN12, variable variable, $$ inside variable value equals outside variable name 13, reference variable, similar pointer,& $a; You can assign it to a variable to display the value stored in the address, in the use of unset (), if there is a referential relationship, just delete one, the other is still in, Two unsettle () 14, data type, data scalar, composite (array,object), special type (resource,null) 15, PHP does not have a command to create a variable.

Variables are created the first time they are assigned a value:

16, PHP has three different scope of variables:

    • Local (partial)
    • Global (globally)
    • Static (statically)
    • Various variables can only be accessed within their scope
    • Accessing global variables inside a function with global
PHP also stores all global variables in an array named $GLOBALS [index]

Typically, all variables are deleted when the function finishes/executes. However, sometimes I need to not delete a local variable. Achieving this requires a bit of further work.

To do this, use the static keyword when you declare the variable for the first time: you can achieve loop increment;

17. The difference between Echo and print:

    • echo-capable of outputting more than one string
    • Print-only one string is output and always returns 1
HTML tags can be included in PHP18, the string is any text in quotation marks, you can use single or double quotation marks    PHP Var_dump () returns the data type and value of the variable; First we must declare the class of the object, which is the data type that stores the data and information about how the data is processed. For this, we must explicitly declare the object in PHP. Use the class keyword. A class is a structure that contains properties and methods. We then define the data type in the object class and then use this data type in an instance of the class: A special NULL value indicates that the variable has no value. Null is the only possible value for the data type NULL. The null value indicates whether the variable is empty. Also used to differentiate between empty strings and null-valued databases. You can empty the variable by setting the value to NULL. 19, PHP string function, strlen (); Strpos () function is used to retrieve the character or text specified within the string, echo Strpos ("Hello world!", "World"), 20, PHP constants, if you want to set constants, use define () Function-it uses three parameters: the first parameter defines the name of the constant, the second parameter defines the value of the constant, and the optional third parameter specifies whether the constant name is case-sensitive. The default is False. 21, operators,
operator name Example Results
. Thread connection $txt 1 = "Hello" $txt 2 = $txt 1. "World!" Now $txt 2 contains "Hello world!"
.= String Assignment $txt 1 = "Hello" $txt 1. = "world!" Now $txt 1 contains "Hello world!"
is + + + +, and it's so complicated,
Typically used in arrays such as: $arr =array (' 1 ' = ' test1 ', ' 2 ' = ' test2 '), where the left represents the key name and the right side represents the key value
is used for object execution methods or for obtaining properties,
22.
The If Else;switch;while;for;foreach loop applies only to arrays and is used to iterate through each key/value pair in the array. For each iteration of the loop, the value of the current array element is assigned to the $value variable, and the array pointer moves one at a time until the last array element is reached.

The following example shows a loop that outputs the value of a given array ($colors):

PHP Learning-7-16

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.