數組$ A的所有值都是相同長度的字符串。將元素插入數組的順序位置?
$A = Array
(
[0] => 03
[1] => 04
[2] => 05
[3] => 06
// [4] => 07 // "07" before "04" position
[4] => 04
[5] => 05
[6] => 06
// [8] => 07 // "07" before "08" position
[7] => 08
[8] => 03
[9] => 04
[10] => 05
[11] => 06
[12] => 07 // it is existing
[13] => 08
) ;
我想將 「07」 元素,如果it is not existing
「04」 或從位置 「08」 position.start 1
所以這將是改變
$A = Array
(
[0] => 03
[1] => 04
[2] => 05
[3] => 06
[4] => 07 // just appended
[5] => 04
[6] => 05
[7] => 06
[8] => 07 // just append
[9] => 08
[10] => 03
[11] => 04
[12] => 05
[13] => 06
[14] => 07
[15] => 08
) ;
任何人前後知道如何做到這一點,請幫助我嗎?
「附加」意味着_insert在end_。你在更廣泛地討論_插入_ – 2011-06-09 15:36:04
是的。你是對的, – newbie 2011-06-09 15:38:03
@Tomalak我相信他一般都在談論家庭作業...... – Frankie 2011-06-09 15:38:28