i have aproblem for a few days right now :s …
I’m trying to get some changing data inside a string, the string is something like this:
<docdata>
<!-- News Identifier -->
<doc-id id-string ="YBY15349" />
<!-- Date of issue -->
<date.issue norm ="2012-09-22 19:52" />
<!-- Date of release -->
<date.release norm ="2012-09-22 19:52" />
</docdata>
What i need is only the date inside the “2012-09-22 19:52” , the string its stored in some type of xml, malformed by the way. So i can’t use normal xml parser, i load/read the file already to change some charset
$fname = $file;
$fhandle = fopen($fname,"r");
$content = fread($fhandle,filesize($fname));
str_replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>", $content);
etc..
this work like a charm, but with the string i cant use it.
I try with preg_match_all but i can`t get it right.
Its there a simple way to search this value
<date.issue norm ="2012-09-22 19:52" />
and get just the date in a variable?
thanks in advance and sorry for my english.
From the PHP documentation:
Consequently, your code would become:
The default behavior is to store the parenthesized matches in the array
$date[1]. Therefore, you might loop through$date[1][0],$date[1][1], and so on.