PHP
php语言
类似与其他语言
<?php
phpinfo()
echo "Hello <span style = 'color:pink;'>PHP</span>" ;
$name = "PHP";
$$name = "abc";
echo $name;
echo $PHP;
unset($name);
var_dump($name)
$a = 10;
$b = $a;
$c = &$a;
$str = <<<abc
&(**(*&(&
abc;
$str = "hey".$name;
$cmd = "ipconfig";
echo "<pre>".`$cmd`; 用cmd执行命令
?>
数组
$stu1;
$stu1[] = $name;
$stu1[] = $sex;
$stu1[] = $age;
$stu1[] = $score;
$stu1[] = 23;
$stu1 = array("abc",true,24,69);
$stu1 = array(
10 => "abc",
true,20,99
);
$stu1 = array(
'name' => "abc",
'sex' => true,
'age' =>20,
'score' =>99
);
多维数组
$stu = array($stu1,$stu2,$stu3);
echo "我的成绩是".$stu['stu1']['score']
遍历
for($i = 0;$i < count($stu1);$i++){
}
foreach($stu1 as $k => $value){
echo $value."<br />";
echo "\$stu3[{$k}] = ".$value."<br />";
}
|