Home > Backend Development > PHP Tutorial > 小白提问 将数组中的元素是字符串的元素输出到P标签内 如何写呢

小白提问 将数组中的元素是字符串的元素输出到P标签内 如何写呢

WBOY
Release: 2016-06-13 12:21:49
Original
1195 people have browsed it

小白提问 将数组中的元素是字符串的元素输出到P标签内 怎么写呢
小白提问 将数组中的元素是字符串的元素输出到P标签内 怎么写呢
------解决思路----------------------

<br /><?php<br />$arr = array(1,'a','b','1','2',3,4,5);<br /><br />foreach($arr as $v){<br />    if(gettype($v)=='string'){<br />        echo '<p>'.$v.'</p>';<br />    }<br />}<br />?><br />
Copy after login

a
b
1
2

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template