note 21777 added to function.trim
| From: | j dot metzger at steptown dot com | Date: | Sun, 26 May 2002 14:21:43 +0000 |
| Subject: | note 21777 added to function.trim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31049@lists.php.net to get a copy of this message | ||
Be careful when you use the charlist with the hex-codes...
use e.g. \x22 instead of \0x22 (this last thing won't work).
An example to strip quotes ' " ' (double quotes) and " ' " (single
quotes) is to do this:
$example[0]='"hello"';
$example[1]="'baby'"
foreach ($example as $key => $val)
$example[$key]=trim($val,"\x22\x27");
# this works brilliant, but be aware:
# $example[$key]=trim($val,"\0x22\0x27");
# won't work !!!
-> tested on php 4.2.1
--
http://www.php.net/manual/en/function.trim.php
http://master.php.net/manage/user-notes.php?action=edit+21777
http://master.php.net/manage/user-notes.php?action=delete+21777
http://master.php.net/manage/user-notes.php?action=reject+21777