I'm trying to write a simple function in PHP. Basically it should replace sweden characters in a string parameter with characters that can be interpreted by all web browsers.
When I test the script I get a Parse error like this:
Seems pretty strange since I can't see anything wrong with the function. The code looks like this:Parse error: parse error in /home/emergosim/scripts/laddaupp.php on line 4
Code: Select all
<?php
session_start()
function replace_åäö( $string )
{
// This function replaces the swedish characters å, ä, ö with the
// characters a, a, o which can be interpreted by all web browsers
$invalid = array("å", "ä", "ö");
$valid = array("a", "a", "o");
$newString = str_replace($invalid, $valid, $string);
return $newString;
}
?>