温故而知新:PHP温习1

<?php
//echo phpinfo();
?>

<?php
?>

**
//

<br>

//$a=10;
<br>
//$a = 1 + 10;
<br>

<?php
//可变变量
$a= b;
$$a = c; //$b = c;
echo $a.$b;
?>
<br>

<?php
//引用赋值
$a =1;
$b = &$a;
echo $b;

$b = 123456;
echo $a;
echo “<br>”;
echo $b;

?>

<br>
变量类型:布尔,整数,浮点,字符串,数组,对象,资源,NULL

true false;

<br>
<?php
//单引号变量不变输出
$a = 1;
echo ‘aaaaaaaaaaaaa.$a’; // aaaaaaaaaaaaa.$a
echo “aaaaaaaa.$a”; //aaaaaaaa.1
?>
<br>
<?php
is_bool;
is_array;
is_bool;
is_callable;
is_dir;

?>

<br>

<?php
//floatval();
//intval();
//boolval();
//strval();
//settype(“”,””);
//gettype(“”,””);

?>

<br>
<?php
//常量
define(“ABC”,”abc”);

?>

<br>
<?php
$a =1;
$b = 2;

//$a = $b ? “正确” : “错误”;

?>

<br>
<?php
$aa = 1;
$bb = 2;
?>

<?
/*
if(){

}

if(){

}else{

}

if(){

}elseif(){

}

if($aa == $bb){
echo “正确”;
}else{
echo “错误”;
}

switch(){
case 1;
echo “111111”;
break;
case 2;
echo “222222”;
break;
case 3;
echo “33333333”;
break;
}

while(){

}

do while(){

}
*/
?>

<?php
/*
$cs = 1;
while($cs <= 10){
echo “第”.$cs.”次”;
$cs++;
}
*/

$abc = 1;

do{

echo $abc;

}while($abc > 5);

?>

<br>
<?php
for($i= 0; $i<20; $i++){
echo $i;
}

/*

break;
continue;
exit;

*/

?>

<br>
<?php
function abcd(){
echo 123456789;
}
abcd();

function jmz($name){ //形参
echo $name;
}
jmz(“吴垒”);//实参

echo “<br><br><br><br>”;

$na = “全局变量”;
function ab($abc){
return $na.$abc;
}
//全局变量调用不到
echo ab(“吴垒”);

?>

发表评论

邮箱地址不会被公开。