View Single Post
Old 06-25-2009, 01:18 PM   #1 (permalink)
tech
The Wanderer
 
Join Date: Jun 2009
Posts: 20
Thanks: 2
tech is on a distinguished road
Default pfp fatal error:cannot redeclare extract()

dear all
I am new in php programing and I wrote one function in which I am trying to remove an index from an array using "array_splice".but I don't know i am using in a proper way or not.so please tell me how to remove an index from an array and this fatal error..
I am including my code :
thanks
Code:
<?php
function extract($this)
{
	if($this->parent)
	{
		try
		{     
		array_splice($parent->content,$this);
            }
            catch(Exception $e)
			{
				}

         }
        $lastChild=$this->lastRecursiveChild();
        $nextElement =$lastChild->next;

        if($this->previous)
         {
		$this->previous->next=$nextElement;
	 }
        if($nextElement)
         {
		$nextElement->previous=$this->previous;
	 }
        $this->previous=null;
        $lastChild->next = Null;
        $this->parent = Null;
        if ($this->previousSibling)
	{
		$this->previousSibling->nextSibling = $this->nextSibling;
        }
 	if ($this->nextSibling)
	{
		$this->nextSibling->previousSibling = $this->previousSibling;
 	}
	$this->previousSibling = $this->nextSibling = Null;
        return $this;
}
?>
tech is offline