note 57517 rejected from function.substr by betz
| From: | betz@php.net | Date: | Thu, 06 Oct 2005 11:23:45 +0000 |
| Subject: | note 57517 rejected from function.substr by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96503@lists.php.net to get a copy of this message | ||
Note Submitter: willa4you at inwind dot it
----
I'm doing a little Guestbook for my site, and I want that the php code read the message text
word by word, to control their lenght. But, I have first to control that the following word is not a
piece of html code, so I write this control:
$stringa = '<a href="http://www.google.com>Ciao
dall'Italia!</a>';
$code = substr($stringa, 0, 1);
if ($code == "<"){
$a = strpos($stringa, ">");
$elab = substr($stringa, 0, $a+1);
$stringa = substr($stringa, $a+1);}
... ...
...
My problem is that when it does this control for the first time, $code takes the value of h, because
substr begin from "http://" not from "<a... ".
How can I explain this? Thank you for your attenction and sorry for my maccheroni/English...