maybe implode?
$u=preg_replace("/[^$chars]/e","%".implode('',unpack("H2", "$0")), $u);

adrian porter wrote:


I want to do the following:


$u=preg_replace("/[^$chars]/e",'"%".unpack("H2", "$0")', $u);

However, as you know, unpack returns an array. I tried this instead:

$u=preg_replace("/[^$chars]/e",'"%".(unpack("H2", "$0")[""])', $u);

but that isn't syntactically correct. I know that this is possible to remedy using a user function but I do this kind of thing very often (grab the contents of an array value in one line of code) and want to be able to do it without splitting it into multiple lines. Is that possible?

thanks.
adrian




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to