Hello all, I am VERY new to PHP and this site. I just upgraded the PHP (4.2 to 5.3) on our LAMP server .
This is the error we're getting in the error log:
[error] PHP Fatal error: Cannot redeclare http_build_query() in /XMLGEN/functions/f_http_build_query.php on line 5
and here is the PHP code:
<?php
////////////////////////////////////////////////
if(!defined('http_build_query'))
{
function http_build_query($array, $flags='', $flags_unchecked=TRUE, $index="")
{
if($flags_unchecked)
{
if(is_string($flags))
{
$flags = ereg_replace("[^a-z0-9_]", "", $flags);
}
else
{
$flags = '';
}
}
$string = "";
if(is_array($array))
{
foreach($array as $name => $value)
{
if(is_array($value))
{
if($index=="")
{
$string.=http_build_query($value, $flags, FALSE, $name);
}
else
{
$string.=http_build_query($value, $flags, FALSE, $index."[".$name."]");
}
}
else
{
if($index=="")
{
if(is_int($name))
{
$name=$flags.$name;
}
$string .= $name . "=" . urlencode($value) . "&";
}
else
{
$string .= $index . "[" . $name . "]=" . urlencode($value) . "&";
}
}
}
if($index=="")
{
$string=ereg_replace("&$","",$string);
}
}
return $string;
}
}
?>
It is basically the same issue that this guy had: http://www.phpbuilder.com/board/showthread.php?p=10977528#post10977528
but he did not say how he fixed it.
Thanks in advance!
cheers,
chips