note 21777 deleted from function.trim by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 12:18:52 +0000 |
| Subject: | note 21777 deleted from function.trim by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189624@lists.php.net to get a copy of this message | ||
Note Submitter: j dot metzger at steptown dot com
----
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