PHP Learning Notes (i)
PHP script to end. On a server that supports shorthand, you can use it to start and end script blocks. For compatibility, try to use the standard form. PHP usually contains HTML tags, like HTML files, as well as some PHP script code. Here is a simple PHP code,
There are two basic instructions for outputting text via PHP, Echo and print.
All variables in PHP start with the $ symbol.
The correct way to set a variable is:
$var _name = value;
PHP is a loosely typed language, and in PHP it is not necessary to declare a variable before setting it.
Depending on how the variable is set, PHP automatically converts the variable to the correct data type.
In PHP, variables are automatically declared when they are used.
In PHP, there is only one string operator.
The collocated operator (.) Used to connect two strings together.
Such as:
$txt 1= "Hello World";
$txt 2= "Nihao";
echo $txt 1. " " . $txt 2;
?>
The above code output
Hello World Nihao
The Strpos () function is used to retrieve a string or a character within a string.
If a match is found in the string, the function returns the first matching position. If no match is found, FALSE is returned.
Such as:
The return is 6. (Starting from 0)