Blogger Information
Blog 7
fans 0
comment 0
visits 2399
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP的8种变量
东风又西风
Original
312 people have browsed it

把课件新闻内容以数组的方式历遍 输出

  1. <?php
  2. $lists = [
  3. ['content' => '切实做好高风险岗位从业人员疫情防控。'],
  4. ['content' => '切实做好高风险岗位从业人员疫情防控。'],
  5. ['content' => '切实做好高风险岗位从业人员疫情防控。'],
  6. ['content' => '切实做好高风险岗位从业人员疫情防控。'],
  7. ['content' => '切实做好高风险岗位从业人员疫情防控。'],
  8. ['content' => '切实做好高风险岗位从业人员疫情防控。'],
  9. ['content' => '切实做好高风险岗位从业人员疫情防控。'],
  10. ['content' => '切实做好高风险岗位从业人员疫情防控。'],
  11. ['content' => '切实做好高风险岗位从业人员疫情防控。'],
  12. ['content' => '切实做好高风险岗位从业人员疫情防控。'],
  13. ['content' => '切实做好高风险岗位从业人员疫情防控。']
  14. ];
  15. $list = '';
  16. foreach ($lists as $k => $v) {
  17. extract($v);
  18. $list .= "<a href='' >{$content}</a><br> ";
  19. }
  20. echo $list;

PHP 的8种变量

1. 字符串

$sting=’hello world’;

2. 整数

$num=98;

3.浮点数

$fot=12.21;

4.布尔值

$boo = ture;

5.数组

(1)索引数组

$arr = [1,2,3,4,5,6,7,8];

(2)关联数组

$arr = [‘id’=>1, ‘uname’=>’张三’,’psw’=>’123456’]

6. 对象

class obj = { public $name;
public $id;
public $psw;
function login(){};
}

7. 资源类型

$pdo = new PDO(‘mysql:host=localhost;dbname=phpcn22’, ‘root’, ‘root’);

8.null

$abc = null;

Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!