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

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

WBOY
WBOYOriginal
2016-06-23 13:32:521391browse

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


回复讨论(解决方案)

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

a
b
1
2

Statement:
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