Tuesday, 7 November 2017

php syntax error on line 9

I have been staring at this for an hour now. It says I
have an

Parse error: syntax error, unexpected '{' in line 9.



Could someone please look at this for me.
Thanks in
advance.




if(isset($_POST['submit']))
{

function foo($a, $b)
{

foreach(array_keys($a) as
$i)
{
if(array_key_exists($i, $b){
$result[$i] =
$a[$i]*$b[$i];
}else{
$result[$i] = 0;
}

}
foreach(array_keys($b) as $i)
{

if(not
array_key_exists($i, $a){ //exists in b but not i a
$result[$i] =
0;
}
}
return
$result
}
}

?>

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...