Home  >  Article  >  Backend Development  >  Use of variables in php learning_PHP tutorial

Use of variables in php learning_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:29:03885browse

Copy code 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."< br>";//Output "one"
echo $$$three."
";//Output "######"

//There are 8 in php Type
//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;//Octal declaration
$int=0xff;//Hexadecimal declaration
$float=3.14E+5;//Scientific notation
$float=3.14E -5;

//All cases are false
$bool=false;
$bool=0;
$bool=0.000;
$bool=null;
$bool="";
$bool=" ";
$bool="0";
$bool=array();

//String declaration
//1. Both single quotes and double quotes can declare strings
//2. There is no length limit for the declared strings
//3. In double-quoted strings, variables can be parsed directly , and you can use escape characters directly (you can escape the single quote itself, or you can escape the escape character "")
//4. In a single-quoted string, variables cannot be parsed directly, nor can Use escape characters
//5. Double quotes can no longer be used within double quotes, and single quotes can no longer be used within single quotes
//6. It is best to use single quotes,
$str=' aaaaa';
$str="aaaa";
//Delimiter declares a string, a large number of strings
//test is a custom string, there cannot be any characters after it, and there are no spaces. No
//It must also end with the custom string test, and there cannot be any characters before the end
$str=<<this write content...
test;
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323473.htmlTechArticleCopy the code as follows: ?php //Quote $one="test"; two=$one;// Equivalent to passing an address, two variables point to one address //Dynamic variable $one="######"; $two="one"; $three="two"; echo $t...
Statement:
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