Re: search
| From: | Lasse | Date: | Tue, 03 Jul 2001 20:14:38 +0000 |
| Subject: | Re: search | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56045@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "AJDIN BRANDIC" <abrandic@coventry.ac.uk>
To: "Tom Carter" <subs@roundcorners.com>
Cc: <php-general@lists.php.net>
Sent: Tuesday, July 03, 2001 2:57 PM
Subject: Re: [PHP] search
> On Tue, 3 Jul 2001, Tom Carter wrote:
>
> > Rather than trying to break it into an array, you can examine the
rightmost
> > character as follows
> >
> > $search="dogs";
> > if(substr($search,-1)=='s') $search=substr($search,0,-1);
> OK, thanks. I am already breaking input search string into an array using
> a ',' as the seperator. Then I loop while there are elements in this new
> array and build the search query.
Actually strings are also arrays (at least in PHP4)...
Try this for example:
$s = 'dogs';
echo $s[strlen($s)-1];
HTH
--
Lasse