PHP and Mysqlweb application development Core Technology Part 1 Basics of Php-1 learn about php. 1.1 The first php copy code is as follows: htmlheadtitleMyFirstPHPProgramtitleheadbody? PhpechoHelloEverybody !;? Bodyhtml appending: phpinfo () function usage 1.2 input 1.1 first php
The code is as follows:
My First PHP Program
Echo "Hello Everybody! ";
?>
Additional: phpinfo () function usage
1.2 enter the php script
1.2.1 mark the php code section
1.2.2 statements and comments
/**/
//
#
#
1.2.3 mix of php and html
1.3 How to store data
1.4 input the basic data type of php
1.4.1 number: (integer (int) and floating-point number (float) 8 digits indicate that 0 (zero) must be added before the number, and 0x must be added before the number in hexadecimal notation.
Note: During the 1 floating point operation, only the approximate value is obtained.
2 5/2 = 2.5 use the round () function to take an integer
1.4.2 string
Single quotes: ''. to include single quotes in a string, you only need to add a backslash before it.
The simplest way to define a string is to enclose it with single quotes (punctuation marks ').
To output a single quotation mark, you must add a backslash (\) before it (\). To output a backslash before a single quotation mark or at the end of a string, enter two (\\)
Note: If a backslash is added before any other character, the backslash is directly output.
Double quotation marks ""
Escaped characters escape character Meaning
\ N line feed (LF or 0x0A (10) in ASCII)
\ R press enter (CR or 0x0D (13) in ASCII)
\ T horizontal tab (HT or 0x09 (9) in ASCII)
\ V vertical tab (VT or 0x0B (11) in ASCII) (since PHP 5.2.5)
\ F form feed (FF or 0x0C (12) in ASCII) (since PHP 5.2.5)
\ Backslash
\ $ Dollar tag
\ "Double quotation marks
\ [0-7] {} the string that matches the expression order is an octal character
\ X [0-9A-Fa-f] {} the string that matches the expression order is a hexadecimal character
1.5 some very useful functions
1.5.1 nl2br: insert an html line break in the output of each new line (\ n) of the string
The code is as follows:
Echo nl2br ("foo ISN'T \ n bar ");
?>
1.5.2 var_dump: view the type and variable value
1.5.3 print_r: returns the result to a string instead of outputting the result to the output stream. This user-friendly output is particularly useful for objects and arrays.
Print_r () displays easy-to-understand information about a variable. If the value is string, integer, or float, the variable value is printed.
If array is provided, keys and elements are displayed in a certain format. Objects are similar to arrays.
1.5.4 var_export: it is similar to var_dump, but its output is actually a valid php code representation of the provided data value.
The code is as follows:
$ Arr = array (1, 2, 4 );
Var_exprot ($ arr );
?>
Http://www.bkjia.com/PHPjc/323904.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/323904.htmlTechArticle1.1 First php code: html head titleMy First PHP Program/title/head body? Php echo "Hello Everybody! ";? /Body/html appending: phpinfo () function usage 1.2 input...