在数组中插入元素 [英] inserting elements within an array

查看:91
本文介绍了在数组中插入元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




使用PHP 4.4.4,我有这个数组


$ my_arr = array(" a"," ; b"," c"," d");


插入元素|的最简单方法是什么?数组之间

数组的结果是


数组(" a"," |"," b"," ; |"," c"," |"," d");


?谢谢, - 戴夫

Hi,

Using PHP 4.4.4, I have this array

$my_arr = array("a", "b", "c", "d");

What is the easiest way to insert the element "|" between the elements
of the array so that the result is

array("a", "|", "b", "|", "c", "|", "d");

? Thanks, - Dave

推荐答案

my_arr = array(" a"," b"," c"," d");


插入元素|的最简单方法是什么?数组之间

数组的结果是


数组(" a"," |"," b"," ; |"," c"," |"," d");


?谢谢, - 戴夫

my_arr = array("a", "b", "c", "d");

What is the easiest way to insert the element "|" between the elements
of the array so that the result is

array("a", "|", "b", "|", "c", "|", "d");

? Thanks, - Dave


la * **********@zipmail.com 写道:




使用PHP 4.4.4,我有这个数组

Hi,

Using PHP 4.4.4, I have this array


my_arr = array(" a"," b"," c"," d");


插入元素|的最简单方法是什么?数组之间

数组的结果是


数组(" a"," |"," b"," ; |"," c"," |"," d");


?谢谢, - 戴夫
my_arr = array("a", "b", "c", "d");

What is the easiest way to insert the element "|" between the elements
of the array so that the result is

array("a", "|", "b", "|", "c", "|", "d");

? Thanks, - Dave



最简单,恕我直言

Easiest, IMHO


这篇关于在数组中插入元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆