php 函数内爆调整
我尝试使用 implode 打印数组,但我想调整它,所以内爆的“粘合剂”显示每两个元素,而不是每个元素。
$nombreNombre=array('josh','13','mike','44','dude','98','scott','450');
echo '<li>' . implode('</li><li>', $nombreNombre).'</li>
我得到:
我想要:
im trying to print an array using implode, but i want to tweak it, so the "glue" of the implode show every two element, and not in every element.
$nombreNombre=array('josh','13','mike','44','dude','98','scott','450');
echo '<li>' . implode('</li><li>', $nombreNombre).'</li>
with that im getting:
and i want:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过
array_chunk
运行$nombreNombre
,执行array_map
将每对转换为字符串,然后implode
。You could run
$nombreNombre
througharray_chunk
, do anarray_map
to convert each pair to a string, thenimplode
.