A definitive guide to PHP development

Source: Internet
Author: User

Declaration and naming of 3.2.1 variables
1<?PHP2     $title= "Hello";//correct3     $title 123= "Hello";//correct4$123title= "Hello";//Error5     $_title= "Hello";//correct6[Email protected]#title= "Hello"; Error7     $url= "Hello";//we get a variable URL8     Echo $url;//Result: Hello9     unset($url);//delete a variable URLTen     Echo $url;//result is empty One?>
3.2.2 variable variable and reference assignment
1 <? PHP 2     $var= "php"; 3     $php= "Hello"; 4     Echo $var;   // Output result php 5     Echo $$var;   // Output Result Hello 6 ?>
3.3.1 String
1<?PHP2     $title= "Hello"; 3     Echo' $title, World ';//results: $title, World4     Echo"$title, World ";//results: Hello,world5     Echo"${title},world";//results: Hello,world6     Echo"{$title},world ";//results: Hello,world7     Echo"\ $title, World";//results: $title, World8?>
Casting and application of 3.3.8 type
//convert other types to integral type<?PHP$php=100.10; Echo(int)$php;//Output Result:    $php=true; Echo(int)$php;//output results: 1    $php= "123php"; Echo(int)$php;//output Result: 123    $php= "Php123"; Echo(int)$php;//output results: 0?>//other types are converted to String type<?PHP$php=100.1; Var_dump((string)$php);//Output: String (4) "100.1"    $php=true; Echo(string)$php;//output results: 1?>//other types are converted to floating-point type<?PHP$php= "123.2php"; Var_dump((float)$php);//output Result: float (123.2)    $php= "php123.2"; Var_dump((float)$php);//output results: (0)?>//Other types convert to Boolean<?PHP$php= "PHP"; Var_dump((BOOL)$php);//Output Result: bool (TRUE)    $php=0; Var_dump((BOOL)$php);//Output Result: bool (false)?>

A definitive guide to PHP development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.