Use of php learning variables

  • 2020-05-07 19:16:52
  • OfStack


<?php 
// reference  
$one="test"; 
two=&$one;// It's the same as passing the address, and the two variables point to 1 An address  

// Dynamic variables  
$one="######"; 
$two="one"; 
$three="two"; 

echo $three."<br>";// The output "two" 
echo $$three."<br>";// The output "one" 
echo $$$three."<br>";// The output "######" 

//php There are 8 A type of  
//4 Kind of scalar:  int integer 
// bool boolean 
// float,double,real 
// string 
//2 Species composite type:  array 
// object 
//2 Special types:   The resource type  resource 
//  Empty type  null 


// Declaration of integers  
$int=10; //10 Hexadecimal statement  
$int=045;//8 Hexadecimal statement  
$int=0xff;//106 Hexadecimal statement  
$float=3.14E+5;// Scientific enumeration  
$float=3.14E-5; 

//1 is false In the case  
$bool=false; 
$bool=0; 
$bool=0.000; 
$bool=null; 
$bool=""; 
$bool=" "; 
$bool="0"; 
$bool=array(); 

// Declaration of strings  
//1. Both single and double quotes can declare strings  
//2. The declared string has no length limit  
//3. In double-quoted strings, you can either parse variables directly or use escape characters directly ( You can escape the single quote itself or escape characters "\") 
//4. In single-quoted strings, variables cannot be resolved directly, and escape characters cannot be used  
//5. You can no longer use double quotes in double quotes and single quotes in single quotes  
//6. It's best to use single quotes,  
$str='aaaaa'; 
$str="aaaa"; 
// Delimiters declare strings, lots of strings  
//test It's custom 1 String, can not have any character after, space can not  
// Also want to test The end of this custom string cannot have any characters before the end  
$str=<<<test 
this write content...... 
test; 
?> 


Related articles: