From: [EMAIL PROTECTED] Operating system: any PHP version: 4.0.5 PHP Bug Type: Feature/Change Request Bug description: two new array functions I'd like to propose two new array functions. I currently have the following implementation of del() and double() in PHP, but IMHO it would be better to have these (or atleast del()) natively in PHP. When using unset($array[$index]) on array, no re-indexing is performed: <?php $test = array(1,2,3,4,5,6); unset($test[2]); print_r($test); ?> Array ( [0] => 1 [1] => 2 [3] => 4 [4] => 5 [5] => 6 ) The del() method in the floowing code re-indexes the array: <?php class ftk_array { var $data; function ftk_array($data=array()) { $this->data=$data; } function del($pos) { for($i=$pos+1;$i<count($this->data);$i++) { $this->data[($i-1)]=$this->data[$i]; } unset($this->data[count($this->data)-1]); } function double($pos) { for($i=count($this->data);$i>$pos;$i--) { $this->data[($i)]=$this->data[$i-1]; } } } $test=new ftk_array(array(1,2,3,4,5,6)); $test->del(1); $test->double(4); print_r($test->data); ?> The double() method creates a clone of a given array element, while it maintainsthe indexes as well. -- Edit Bug report at: http://bugs.php.net/?id=11077&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]