<?php
$a= "刘和娟是我的梦中情人";
$b= $a;
$c= &$a;
$a = "不能忘记你,我魂牵梦绕的女孩!";
echo $b."<br />";
echo $c."<br />";
?>
$a= "刘和娟是我的梦中情人";
$b= $a;
$c= &$a;
$a = "不能忘记你,我魂牵梦绕的女孩!";
echo $b."<br />";
echo $c."<br />";
?>
2018-03-09
<?php
$p = "PII"; //定义变量
define("PI",3.14); //定义常量
define($p,3.14); //定义常量
echo PI;
echo "<br />";
echo "$p";
?>
$p = "PII"; //定义变量
define("PI",3.14); //定义常量
define($p,3.14); //定义常量
echo PI;
echo "<br />";
echo "$p";
?>
2018-03-09
<?php
//A例子
$num = 2; //条件 = 2
$sum = 10;
switch($num){//执行(从条件2开始执行)
case 1://case/事例
$sum = $sum + 1000;
case 2:
$sum = $sum + 10;
break;//break/打破(中断)
case 3:
$sum = $sum + 10;
default:
$sum = $sum + 10;
}
echo "A例子的值是:".$sum."<br />";
//A例子
$num = 2; //条件 = 2
$sum = 10;
switch($num){//执行(从条件2开始执行)
case 1://case/事例
$sum = $sum + 1000;
case 2:
$sum = $sum + 10;
break;//break/打破(中断)
case 3:
$sum = $sum + 10;
default:
$sum = $sum + 10;
}
echo "A例子的值是:".$sum."<br />";
2018-03-09
function position($maxline,$no){
$line = ceil($no/$maxLine);
$row = $no%$maxLine?$no%$maxLine:$maxLine;
echo $line," ",$row;
}
position(4,20);
$line = ceil($no/$maxLine);
$row = $no%$maxLine?$no%$maxLine:$maxLine;
echo $line," ",$row;
}
position(4,20);
2018-03-09
@IT习者 (第二部分)
$sum = 0;
do{
$num = rand(1,6);
$sum = $sum + $num;
echo "这次掷除了".$num."点";
echo "<br />";
}while($num==6);
echo "do...while例子执行完毕,前进:".$sum ."<br />";
?>
$sum = 0;
do{
$num = rand(1,6);
$sum = $sum + $num;
echo "这次掷除了".$num."点";
echo "<br />";
}while($num==6);
echo "do...while例子执行完毕,前进:".$sum ."<br />";
?>
2018-03-08
@IT习者
<?php
$sum = 0;
$num = rand(1,6);
echo "第一次次掷出了".$num."点";
echo "<br />";
$sum = $sum + $num;
while($num==6){
$num = rand(1,6);
echo "第二次掷出了".$num."点";
echo "<br />";
$sum = $sum + $num;
};
echo "while例子执行完毕,前进:".$sum ."<br />";
<?php
$sum = 0;
$num = rand(1,6);
echo "第一次次掷出了".$num."点";
echo "<br />";
$sum = $sum + $num;
while($num==6){
$num = rand(1,6);
echo "第二次掷出了".$num."点";
echo "<br />";
$sum = $sum + $num;
};
echo "while例子执行完毕,前进:".$sum ."<br />";
2018-03-08