Php Class : Php Dizi Ekleme (Array Insertion)

Php Class : Php Dizi Ekleme (Array Insertion)

class arrayAll 
  { 
     var $startError = 'Warning:Check your input parameters'; 
     var $endError = ''; 
     function Insert($array = '', $position = '' , $elements= '') 
     { 
       if ($position == '' || $array == '' || $elements == '' || $position < 1 || $position > count($array)+1) 
       { 
         echo $this->startError . "insert".$this->endError; 
       } 
       else 
       { 
         $left = array_slice ($array, 0, $position+1); 
         $right = array_slice ($array, $position+1,count($array)); 
         for($i=1; $i< COUNT($elements) ; $i++) 
         { 
           $insert[$i] .= $elements[$i] ; 
         } 
         $array = array_merge ($left, $insert, $right); 
         // echo " Left Count : " . COUNT($left) . "
\n"; 
         // echo " Insert Count : " . COUNT($insert) . "
\n"; 
         // echo " Right Count : " . COUNT($right) . "
\n"; 
         unset($left, $right, $insert); 
       } 
       unset ($position, $elements); 
       return $array ; 
     } 
  }