Return to Snippet

Revision: 38803
at January 8, 2011 03:34 by takel


Initial Code
function array_push_after($src,$in,$pos)
  {
    if(is_int($pos)) 
    {
      $R = array_merge(array_slice($src,0,$pos+1), $in, array_slice($src,$pos+1));
    }
    else
    {
      foreach($src as $k=>$v)
      {
        $R[$k]=$v;
        if($k==$pos)
        {
          $R=array_merge($R,$in);
        }
      }
    }
    return $R;
  }

Initial URL

                                

Initial Description

                                

Initial Title
Array push affter

Initial Tags
php, array

Initial Language
PHP