I can't use array_splice since my element is an object. Instead of inserting it as a whole, it inserts it field by field.
P.S.
I was inserting as Leigh said:
array_splice($original, 2, 0, $obj);
If you pass your object directly to array_splice you will get the behaviour you describe.
I think you are doing this:
$original = array(1, 2, 3, 4, 5);
$obj = new Object;
array_splice($original, 2, 0, $obj);
When you should be doing this:
array_splice($original, 2, 0, array($obj));
This way your object will be inserted as a whole, instead of the individual fields being inserted.
object? Can you just cast it using(array)?