Jordi Canals wrote:
Student wrote:

I want to trim the following text

[i:abcdef]
Hi,

You can do:

$data = '[i:something]';
$array_data = explode(':',$data);

and you will have:
'[i' in $array_data[0]
'something]' in $array_data[1]

If i understod corretly, you want to get only something, so you need $array_data[1]. To take off brackets, just use str_replace();

Hoppe this helps,
Jordi.

Or, better, you can do :

preg_match( "/^\\[i\\:(.*)\\]\$/", "[i:something]", $matches );
$matches[1] will contain "something".

Peter.

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



Reply via email to