Reputation: 20555
I have the following array:
0 = Stat.clicks
1 = Stat.currency
2 = Stat.conversions
3 = Stat.payout
4 = Stat.ltr
Now if i want to push the element Offer.name
ontop of this array without deleting Stat.clicks
which is index 0 how would i do that?
Upvotes: 0
Views: 410
Reputation: 38645
You can use array_unshift which will prepend the new element to the first index of the array.
Example:
$my_array = array("Stat.Clicks", "Stat.currency", "Stat.conversions", "Stat.payout", "Stat.ltr");
array_unshift($my_array, "Offer.name");
$my_array
after array_unshift
becomes:
0 = Offer.name
1 = Stat.clicks
2 = Stat.currency
3 = Stat.conversions
4 = Stat.payout
5 = Stat.ltr
Upvotes: 2