title: Cannot redeclare a function error
body: <p>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.</p>
  
  <pre><code>// 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]) &amp;&amp; ($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]) &amp;&amp; !empty($array[$key]) ? trim($array[$key]) : 'null';
  
      # Check if the key is an array.
      elseif(isset($array[$key]) &amp;&amp; !empty($array[$key]) &amp;&amp; is_array($array[$key])) return isset($array[$key]) &amp;&amp; !empty($array[$key]) ? $array[$key] : null;
  
      # This will regard '0', empty space as falsey.
      # Return value or null.
      else return isset($array[$key]) &amp;&amp; !empty($array[$key]) ? trim($array[$key]) : null;
  }
  
  $array = array(
      'name'=&gt;'Hello',
      'type'=&gt;'{"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);
  </code></pre>
  
  <p>I get this error in my live server which I don't understand it,</p>
  
  <blockquote>
    <p>Fatal error: Cannot redeclare stripslashes_array() (previously
    declared in json.php:16) in
    json.php on line 16</p>
  </blockquote>
  
  <p><strong>line 16</strong> refers to this line <code>function stripslashes_array($array)</code> which does not seem to have any mistake.</p>
  
  <p>Any idea how to fix this?</p>