<?php
//关系运算符
var_dump(0 == "a");
var_dump("1" =="01");
switch("a")
{
case 0:
echo "0";
break;
case "a":
echo "a";
break;
}
echo "<br>";
//位运算符
$a=12;
$b=9;
$c=2;
echo "a=$a b=$b c=$c";
echo "<br>\$a & \$b ="; //与
echo $a & $b;
echo "<br>\$a | \$b="; //或
echo $a |$b;
echo "<br>\$a <<\$c=";//按位异或
echo $a<<$c;
echo "<br>";
//运算符与表达式
$a =5;
$b =3;
echo $a."+".$b."=";
echo $a+$b."<br>";
echo $a."-".$b."=";
echo $a-$b."<br>";
echo $a."*".$b."=";
echo $a*$b."<br>";
echo $a."/".$b."=";
echo $a/$b."<br>";
echo $a."%".$b."=";
echo $a%$b."<br>";
//变量类型自动转换
$var ="1";
echo "$var is a ".gettype($var)."<br>";
$var+=1;
echo "$var is a ".gettype($var)."<br>";
$var+=1.1;
echo "$var is a ".gettype($var)."<br>";
$var =array($var);
echo "$var is a ".gettype($var)."<br>";
//查看变量类型
$a ="Hello\n";
$b = "PHP\r <br>";
$c = "How are you?";
echo $a,$b,$c;
echo "<br>";
echo "\$a=$a \t \$b=$b \t \$c=$c";
//输出变量
$connect=mysql_connect("127.0.0.1","root","1234");
if(!$connect) echo "Mysql Connect Error!";
else echo "only English";
mysql_close();
?>