Posted By


takel on 01/08/11

Tagged


Statistics


Viewed 630 times
Favorited by 0 user(s)

Array push affter


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function array_push_after($src,$in,$pos)
  2. {
  3. if(is_int($pos))
  4. {
  5. $R = array_merge(array_slice($src,0,$pos+1), $in, array_slice($src,$pos+1));
  6. }
  7. else
  8. {
  9. foreach($src as $k=>$v)
  10. {
  11. $R[$k]=$v;
  12. if($k==$pos)
  13. {
  14. $R=array_merge($R,$in);
  15. }
  16. }
  17. }
  18. return $R;
  19. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.