How to efficiently insert elements after another known (by key or pointer) element in a PHP array?

后端 未结 6 1969
萌比男神i
萌比男神i 2021-02-07 11:01

Given an array:

$a = array(
    \'abc\',
    123,
    \'k1\'=>\'v1\',
    \'k2\'=>\'v2\',
    78,
    \'tt\',
    \'k3\'=>\'v3\'
);

Wi

6条回答
  •  灰色年华
    2021-02-07 11:46

    There's a nice function that would help you here: https://gist.github.com/scribu/588429

提交回复
热议问题