PHP的8种变量
把课件新闻内容以数组的方式历遍 输出
PHP 的8种变量1. 字符串
<?php
$lists = [
['content' => '切实做好高风险岗位从业人员疫情防控。'],
['content' => '切实做好高风险岗位从业人员疫情防控。'],
['content' => '切实做好高风险岗位从业人员疫情防控。'],
['content' => '切实做好高风险岗位从业人员疫情防控。'],
['content' => '切实做好高风险岗位从业人员疫情防控。'],
['content' => '切实做好高风险岗位从业人员疫情防控。'],
['content' => '切实做好高风险岗位从业人员疫情防控。'],
['content' => '切实做好高风险岗位从业人员疫情防控。'],
['content' => '切实做好高风险岗位从业人员疫情防控。'],
['content' => '切实做好高风险岗位从业人员疫情防控。'],
['content' => '切实做好高风险岗位从业人员疫情防控。']
];
$list = '';
foreach ($lists as $k => $v) {
extract($v);
$list .= "<a href='' >{$content}</a><br> ";
}
echo $list;
2. 整数$sting=’hello world’;
3.浮点数$num=98;
4.布尔值$fot=12.21;
5.数组$boo = ture;
(1)索引数组
$arr = [1,2,3,4,5,6,7,8];
(2)关联数组
6. 对象$arr = [‘id’=>1, ‘uname’=>’张三’,’psw’=>’123456’]
7. 资源类型class obj = { public $name;
public $id;
public $psw;
function login(){};
}
8.null$pdo = new PDO(‘mysql:host=localhost;dbname=phpcn22’, ‘root’, ‘root’);
【感谢龙石为本站提供数据共享平台 http://www.longshidata.com/pages/exchange.html】$abc = null;