公司有用到这些业务,多了解一下总是没错的。
现在开始一系列的PHP学习啦。。。
<?php $boo=true; if($boo==true) echo ‘变量$boo为真!‘; else echo ‘变量$boo为假!‘; echo "<p>"; $i = ‘只会看到一遍‘; echo "$i"; echo "<p>"; echo ‘$i‘; echo "<p>"; $str1 = 1234567890; $str2 = 0x1234567890; $str3 = 01234567890; $str4 = 01234567; echo ‘数字1234567890不同进制的输出结果:<p>‘; echo ‘十进制的结果是:‘.$str1.‘<br>‘; echo ‘十六进制的结果是:‘.$str2.‘<br>‘; echo ‘八进制的结果是:‘; if($str3 == $str4){ echo ‘$str3 = $str4 = ‘.$str3; }else{ echo ‘$str3 !- str4‘; } $arr1 = array(‘this‘,‘is‘,‘a‘,‘example‘); $arr2 = array(0=>‘php‘,1=>‘is‘,‘the‘=>‘the‘,str =>‘best‘); $arr3[0] = ‘tmpname‘; echo "<p>"; echo $arr1[1]; echo $arr2[‘str‘]; echo $arr3[0]; echo "<p>"; echo "变量(\$string1)直接被赋值为Null:"; $string1 = null; if(is_null($string1)) echo "string1 = null"; echo "<p>"; $num = ‘3.1415926r*r‘; echo ‘使用(integer)操作符转换变量$num类型:‘; echo (integer)$num; echo "<p>"; $boo = "03563562345245"; if(is_numeric($boo)) echo "Yes, the \$boo is a phone number:$boo!"; else echo "Sorry, This is an error!"; echo "<p>"; define ("MESSAGE","能看到一次"); echo MESSAGE."<BR>"; echo "<p>"; echo Message."<BR>"; echo "<p>"; define ("COUNT","能看到多次",true); echo COUNT."<br>"; echo "<p>"; echo Count."<BR>"; echo "<p>"; $name = "count"; echo constant($name)."<BR>"; echo (defined("MESSAGE"))."<BR>"; echo "<p>"; echo "当前文件路径: " .__FILE__; function zdy(){ static $message = 0; $message += 1; echo $message." "; } function zdy1(){ $message = 0; $message += 1; echo $message." "; } for ($i = 0; $i < 10; $i++) zdy(); echo "<br>"; for ($i = 0; $i < 10; $i++) zdy1(); echo "<br>"; ?>
时间: 2024-10-03 14:55:51