I have created a function to extract text in brackets that follows a "<b>" tag in a text to be a html code as follows :
Code: Select all
function ExtractN($tt)
{
$l = "";
$tt = " ".$tt;
while (strpos($tt, "<b> ") != false)
{
$tt = " ".substr($tt, strpos($tt, "<b> ") + 2);
$l = $l.substr($tt, strpos($tt, "(") + 1, strpos($tt, ")") - strpos($tt, "(") - 1).", ";
}
return $l;
}
The issue is that ever and anon - with no pattern that I am able of perceiving - the function returns a correct first entry with the rest being incorrect.
The format of the text that is used as an argument is :
- *A Short Text* being a text of less than 20 characters
Code: Select all
... some HTML tags ...
<b> *A Short Text* (*A Short Text*)</b>
A Longer Text with some HTML tags, but no "<b>" at all
<b> *A Short Text* (*A Short Text*)</b>
A Longer Text with some HTML tags, but no "<b>" at all
<b> *A Short Text* (*A Short Text*)</b>
A Longer Text with some HTML tags, but no "<b>" at all
... et cetera ... some HTML tags ...
.. but sometimes it is "A Short Text, A text from some point of the text, another of that kind, yet another like that"
I am utterly at loss of fiuring out what is the cause of this seeminly arbitrary behaviour of the script and I should like to ask anyone who knows the reason, to inform me. Thank you very much - in advance.