Cannot redeclare a function error
I am trying to remove the slashes from magic quotes from an array. So I have two functions, one is to remove the slashes, another is to set the variable.

    // Strip slashes from an array.
    function strip_magic_quotes($array)
    {
    	if (get_magic_quotes_gpc())
    	{
    		function stripslashes_array($array)
    		{
    			return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
    		}
    		return stripslashes_array($array);
    	}
    	return $array;
    }
    
    function set_variable($array = array(),$key,$params = array())
    {
    	# If $params is not an array, let's make it array with one value of former $params.
    	if(!is_array($params)) $params = array($params);
    	if(!is_array($array)) parse_str($array, $array);
    	
    	# Strip slashes from the array if get_magic_quotes_gpc is on.
    	$array = strip_magic_quotes($array);
    	
    	# This will return true or false.
    	if(in_array('boolean', $params)) return isset($array[$key]) ? true : false;
    	
    	# This will regard '0' as a string.
    	# Return value or 0 as a string.
    	elseif(in_array('0', $params)) return isset($array[$key]) && ($array[$key] == '0') ? trim($array[$key]) : null;
    	
    	# Return null as string if 'null_to_string' is set.
    	elseif(in_array('null_to_string', $params)) return isset($array[$key]) && !empty($array[$key]) ? trim($array[$key]) : 'null';
    	
    	# Check if the key is an array.
    	elseif(isset($array[$key]) && !empty($array[$key]) && is_array($array[$key])) return isset($array[$key]) && !empty($array[$key]) ? $array[$key] : null;
    	
    	# This will regard '0', empty space as falsey.
    	# Return value or null.
    	else return isset($array[$key]) && !empty($array[$key]) ? trim($array[$key]) : null;
    }
    
    $array = array(
    	'name'=>'Hello',
    	'type'=>'{"page":"page"}'
    );
    
    
    # set the required array.
    $items_variable = array(
    	'name',
    	'type'
    );
    
    # loop the array.
    foreach( $items_variable as $item_variable )
    {
    	# set the main variables.
    	$$item_variable = set_variable($array,$item_variable);
    }
    
    print_r($type);

I get this error in my live server which I don't understand it,

> Fatal error: Cannot redeclare stripslashes_array() (previously
> declared in json.php:16) in
> json.php on line 16

**line 16** refers to this line `function stripslashes_array($array)` which does not seem to have any mistake.

Any idea how to fix this?
Cannot redeclare a function error
===

I am trying to remove the slashes from magic quotes from an array. So I have two functions, one is to remove the slashes, another is to set the variable.

    // Strip slashes from an array.
    function strip_magic_quotes($array)
    {
    	if (get_magic_quotes_gpc())
    	{
    		function stripslashes_array($array)
    		{
    			return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
    		}
    		return stripslashes_array($array);
    	}
    	return $array;
    }
    
    function set_variable($array = array(),$key,$params = array())
    {
    	# If $params is not an array, let's make it array with one value of former $params.
    	if(!is_array($params)) $params = array($params);
    	if(!is_array($array)) parse_str($array, $array);
    	
    	# Strip slashes from the array if get_magic_quotes_gpc is on.
    	$array = strip_magic_quotes($array);
    	
    	# This will return true or false.
    	if(in_array('boolean', $params)) return isset($array[$key]) ? true : false;
    	
    	# This will regard '0' as a string.
    	# Return value or 0 as a string.
    	elseif(in_array('0', $params)) return isset($array[$key]) && ($array[$key] == '0') ? trim($array[$key]) : null;
    	
    	# Return null as string if 'null_to_string' is set.
    	elseif(in_array('null_to_string', $params)) return isset($array[$key]) && !empty($array[$key]) ? trim($array[$key]) : 'null';
    	
    	# Check if the key is an array.
    	elseif(isset($array[$key]) && !empty($array[$key]) && is_array($array[$key])) return isset($array[$key]) && !empty($array[$key]) ? $array[$key] : null;
    	
    	# This will regard '0', empty space as falsey.
    	# Return value or null.
    	else return isset($array[$key]) && !empty($array[$key]) ? trim($array[$key]) : null;
    }
    
    $array = array(
    	'name'=>'Hello',
    	'type'=>'{"page":"page"}'
    );
    
    
    # set the required array.
    $items_variable = array(
    	'name',
    	'type'
    );
    
    # loop the array.
    foreach( $items_variable as $item_variable )
    {
    	# set the main variables.
    	$$item_variable = set_variable($array,$item_variable);
    }
    
    print_r($type);

I get this error in my live server which I don't understand it,

> Fatal error: Cannot redeclare stripslashes_array() (previously
> declared in json.php:16) in
> json.php on line 16

**line 16** refers to this line `function stripslashes_array($array)` which does not seem to have any mistake.

Any idea how to fix this?