php和mysql web development (一) how to use php

WBOY
Release: 2016-06-23 14:35:31
Original
943 people have browsed it

<?php/*双引号和单引号 * php中单引号里面内容默认它为字符串 * 所以在php中对于字符串尽量使用单引号*/$str='my name is ';$str1='$str jame green';$str2="$str jame green";$str3=$str.'jame green';echo $str1. '<br/>';//无效的拼接 输出$str jame greenecho $str2. '<br/>';//my name is jame greenecho $str3. '<br/>';//my name is jame green/*php中的变量类型 * integer float string boolean array object *  */$int_val=1;$float_val=0.1;$string_val='my name is mrwu';$boolean_val=true;$array_val=array('name'=>'my name is mrwu');class class_val{}$class_val=new class_val();//object/* * 可变变量 */$varname='name';$$varname='jame green';echo $name. '<br/>';//output jame green;/** * 超级全局变量 * $_REQUEST, $_POST,$_COOKIE,$_FILES,$EVN,$_GET *//* * 算数操作符 +-*.... */$b=6+($a=5);echo $b. '<br/>';//11 先赋值 然后计算echo $b++. '<br/>';//11 这时候b=12echo ++$b. '<br/>';//13$a=&$b;$b=11;echo $a. '<br/>';//11 a是b变量的别名//比较操作符unset($a);unset($b);$a=0;$b='0';//var_dump($a==$b);//var_dump($a === $b);var_dump(false == FALSE);//truevar_dump(false === FALSE);//truevar_dump(false == 0);//truevar_dump(false === 0);//falsevar_dump(false == '');//truevar_dump(false === '');//falsevar_dump(false == "");//truevar_dump(false === "");//falsevar_dump(false == null);//truevar_dump(false === null);//falsevar_dump(false == '0');//truevar_dump(false === '0');//falsevar_dump(false == 00 );//truevar_dump(false === 00 );//falsevar_dump(false == NULL);//truevar_dump(false === NULL);//false/** * ? : @ */$a=5;$b=6;$c = $a > $b ? $a : $b;$d=@(1 / 0);//屏蔽错误信息ini_set('track_errors', 1); echo $php_errormsg;//没有输出/* * 数组运算 */$a=array(1,2,3);$b=array(2,3,4);var_dump($a == $b);var_dump($a != $b);/* * 执行操作符 */$out=`dir c:`;echo $out. '<br/>';/* * instanceof */var_dump($class_val instanceof class_val);//true/* * 测试和设置变量类型 set_type();gettype();intval(); *//* *if elseif while continue break switch ...*/
Copy after login

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template