Re: Strange string stuff -- maybe everything is ending...
| From: | Tedd Sperling | Date: | Fri, 21 Dec 2012 22:10:09 +0000 |
| Subject: | Re: Strange string stuff -- maybe everything is ending... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-319925@lists.php.net to get a copy of this message | ||
On Dec 21, 2012, at 5:05 PM, Ken Robinson <kenrbnsn@rbnsn.com> wrote
> A much easier way to do this would be to use a temporary array and then explode:
>
> $tmp = array();
> while($row = mysql_fetch_array($result)) // pulling stuff from a database
> {
> $tmp[] = $row['category'];
> }
>
> $topic = explode('~',$tmp); // put the delimiter between each entry
> echo($topic); // this result is used in an AJAX script
>
>
> No more worrying about whether the delimiter is the last character.
>
> Ken
Ken:
Slick -- I like it.
But, the question remains -- if you make the last character in a string a '' (or null),
then what's the problem with doing that?
Cheers,
tedd
_____________________
tedd@sperling.com
http://sperling.com