Home >Backend Development >PHP Tutorial >PHP basic learning the use of variables
The code is as follows:
//Quote
$one="test";
two=&$one;//Equivalent to passing an address, two variables point to one address
//Dynamic variable
$one ="######";
$two="one";
$three="two";
echo $three."
";//Output "two"
echo $$three ."
";//Output "one"
echo $$$three."
";//Output "######"
//There are 8 types in php
//4 types of scalars: int integer
// bool boolean
// float, double, real
// string
//2 types of composite types: array
// object
//2 special types: resource type resource
// Empty type null
//Declaration of integer
$int=10; //Declaration of decimal
$int=045;//Declaration of octal
$int=0xff;//Declaration of hexadecimal
$float= 3.14E+5;//Scientific notation
$float=3.14E-5;
//When all are false
$bool=false;
$bool=0;
$bool=0.000;
$bool =null;
$bool="";
$bool=" ";
$bool="0";
$bool=array();
//Declaration of string
//1. Single quotes and double quotes Quotation marks can be used to declare strings
//2. There is no length limit for the declared string
//3. In double-quoted strings, variables can be parsed directly, and escape characters can be used directly (single quotes can be escaped itself, the escape character "") can also be escaped
//4. In a single-quoted string, variables cannot be parsed directly, nor can escape characters be used
//5. It cannot be used in double quotes Double quotes, single quotes can no longer be used within single quotes
//6. It is best to use single quotes,
$str='aaaaa';
$str="aaaa";
//Delimiter declaration string, a large number String
//test is a custom string, there cannot be any characters after it, and spaces are not allowed
//It must also end with the custom string test, and there cannot be any characters before the end
$str=< ;<
test;
>