i have a function that strips the underscore from an array kay and replaces it with a space in order to insert into the database.
when it runs on he test server it runs fine, but when it’s live it reports a syntax error on line 22 — expecting a “)” .
here is the function:
function fixArrayKey(&$arr)
{
$arr=array_combine(array_map(function($str){return str_replace("_"," ",$str);},array_keys($arr)),array_values($arr));
foreach($arr as $key=>$val)
{
if(is_array($val)) fixArrayKey($arr[$key]);
}
}
line 22 is where the $arr=array_combine starts.
for the life of me I can’t see where it has gone wrong or even comprehend why it works on the local server but not the live one.
my live server is an IIS7 server, would that have anything to do with it?
Maybe if you made it a bit simpler you would find where the error lies
A good idea would be to do a
phpinfo()on both development and production environments to identify any differences between them. For instance modules on PHP behave differently on different versions or even PHP itself has different features from version to version.