PHP学习笔记1

发布时间:2007-08-11 03:02:00 阅读:921次

今天终于在网上找到一个PHP空间,可以试用,并且可以立马开通,不放过这样的一个好东东,于是就开始学习了!PHP的配置确实太复杂,在办公室里又不好意思浪费太多的时间。

<?php
echo("hello the world!");   //输出字符串,类似于ASP中的response.write
echo "<br/>";
/*
echo "hello the world!";          //注释,类似ASP中的"'"
*/
//echo "comments";
$name="test";
echo $name."<br>";

$_n="victor";
$_m=".yan";                    //字符串连接符,类似ASP中的"&"
echo $_n.$_m;

$string1="test";
echo "<br/>".strlen($string1);             //计算字符串的长度,类似ASP中的"len"

echo "<br/>".strpos("test","s");       //查找一个字符串,在另一个字符中出现的位置,类似ASP中的"instr"

echo("<br>");


$d=2;   //赋值,跟ASP中一样

if($d==1){   //判断,没有then
 echo "one";
}
else{
 echo("other");      //没有end if
}

echo "<br>";     
$d=date("D"); //返回星期几,为缩写字母    
echo $d."<br>";

$x=2;
switch ($x)
{
case 1:
  echo "Number 1";
  break;           //必须有break
case 2:
  echo "Number 2";
  break;
case 3:
  echo "Number 3";
  break;
default:
  echo "No number between 1 and 3";
}


echo("<br>");

for($i=1;$i<10;$i++){

echo($i);

}

?>

如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术

支付宝 微信

有疑问联系站长,请联系QQ:QQ咨询

转载请注明:PHP学习笔记1 出自老鄢博客 | 欢迎分享