PHP 整理
一、数据类型
- integer ex:$intName1 = 12;
- double ex:$a=100.0235;
- boolean ex:$boolName1 = false;
- string ex:$tringName1 = "hello";
二、集合
- array ex:$array = array(1,2,3);
- object ex:$a = new A();
三、流程
- if ex:
<?php
$foo = "xxx";
if($foo == "xxx")
{
echo "==";
}
else
{
echo "!=";
}
?> - while ex:
$i=1;
while($i<=5)
{
echo "The number is " . $i . "<br />";
$i++;
} - do...while ex:
$i=1;
do
{
echo "The number is " . $i . "<br />";
$i++;
}
while($i<=5); - for
for ($i=1; $i<=5; $i++)
{
echo "Hello World!<br />";
} - foreach
$arr=array("one", "two", "three");
foreach ($arr as $value)
{
echo "Value: " . $value . "<br />";
}
-------------------------------------------------
!!!作者:木由水 http://www.cnblogs.com/muyoushui