Home > Backend Development > PHP Tutorial > PHP and Mysql web application development core technology Part 1 Php basics-1 Start to understand php_PHP tutorial

PHP and Mysql web application development core technology Part 1 Php basics-1 Start to understand php_PHP tutorial

WBOY
Release: 2016-07-21 15:26:27
Original
826 people have browsed it

1.1 The first php

Copy code The code is as follows:



My First PHP Program


echo "Hello Everybody!";
?> ;



Additional: usage of phpinfo() function
1.2 Enter php script
1.2.1 Mark php code Paragraphs
1.2.2 Statements and comments
/* */
//
#
#
1.2.3 Mixing php and html
1.3 How to store data
1.4 Enter the basic data types of PHP
1.4.1 Numbers: (integers (int) and floating point numbers (float)) Octal represents a number that must be preceded by 0 (zero), hexadecimal represents a number that must be preceded by 0x .
Note: 1 When operating with floating point numbers, only approximate values ​​will be taken
2 5/2=2.5 If you want to take an integer, use the round() function
1.4.2 String
Single quotes: ' ', To include a single quote in a string, just precede it with a backslash.
The simplest way to define a string is to surround it with single quotes (punctuation mark ').
To output a single quote, add a backslash () in front of it. To output a backslash before a single quote or at the end of a string, enter two (\)
Note that if a backslash is added before any other character, the backslash will be output directly. .
Double quotes " "
Escaped characters Meaning
n Line feed (LF or 0x0A (10) in ASCII)
r Carriage return (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 Page feed (FF or 0x0C (12) in ASCII) (since PHP 5.2.5)
\ backslash
$ dollar mark
" double quotes
[0-7]{1,3} conforms to this expression The string in the order of the expression is an octal character
x[0-9A-Fa-f]{1,2} The string in the order of the expression is a hexadecimal character
1.5 Some in Very useful function
1.5.1 nl2br: Insert html newline character after each new line (n) in the string
Copy code The code is as follows :

echo nl2br("foo isn'tn bar");
?>

1.5.2 var_dump: View Types and variable values
1.5.3 print_r: Return the result to a string instead of outputting the result to the output stream. This user-friendly output is especially useful for objects and arrays
print_r() Displays human-readable information about a variable. If given as a string, integer, or float, the variable value itself will be printed.
If given as an array, the keys and elements of the array will be displayed. Similar.
1.5.4 var_export: It is similar to var_dump, except that its output is actually a valid php code representation of the provided data value
Copy code The code is as follows:

$arr=array(1,2,3,4);
var_exprot($arr);
? >

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323904.htmlTechArticle1.1 The first php copy code is as follows: html head titleMy First PHP Program/title /head body ?php echo "Hello Everybody!"; ? /body /html Additional: Usage of phpinfo() function 1.2 Input...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template