Hi
I'm trying to use preg_replace ucwords strtolower to convert an XML file with 100s of different names in upper case to ucwords strtolower
Can't get it to work
had a look at the manual but trying to understand the principle of how it works
I know this example is incorrect ...
eg
$filename = "name.xml";
$data = preg_replace("<name>(.*?)</name>", "<name>ucwords (strtolower(.*?));</name>", file_get_contents($filename));
$fp = fopen($filename, "w");
fwrite($fp, $data);
fclose($fp);
eg
<name>JOE BLOGGS</name>
<name>FRED JONES</name>
to
<name>Joe Bloggs</name>
<name>Fred Jones</name>
Can anyone point me in the right direction?
Thanks in advance
I'm trying to use preg_replace ucwords strtolower to convert an XML file with 100s of different names in upper case to ucwords strtolower
Can't get it to work
had a look at the manual but trying to understand the principle of how it works
I know this example is incorrect ...
eg
$filename = "name.xml";
$data = preg_replace("<name>(.*?)</name>", "<name>ucwords (strtolower(.*?));</name>", file_get_contents($filename));
$fp = fopen($filename, "w");
fwrite($fp, $data);
fclose($fp);
eg
<name>JOE BLOGGS</name>
<name>FRED JONES</name>
to
<name>Joe Bloggs</name>
<name>Fred Jones</name>
Can anyone point me in the right direction?
Thanks in advance