且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP list,explode的使用

更新时间:2022-08-18 22:12:48

PHP list,explode的使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
header("Content-type: text/html; charset=utf-8");
echo "explode 使用<br>";
$student "Zhangsan,Lisi,Wangwu";
$studentArray=explode(",",$student);
echo $studentArray[0]."<br>";
echo  $studentArray[1]."<br>";
 
echo "<br>list 使用<br>";
list($stu1,$stu2,$stu3) = explode(",",$student);
echo $stu1."<br>";
echo $stu2."<br>";
echo $stu3."<br>";
?>

1.header("Content-type: text/html; charset=utf-8"); 解决中文乱码问题。

输出结果:

explode 使用
Zhangsan
Lisi

list 使用
Zhangsan
Lisi
Wangwu

  

 


本文转自Work Hard Work Smart博客园博客,原文链接:http://www.cnblogs.com/linlf03/p/5909102.html,如需转载请自行联系原作者