Re: i need help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Student wrote:
I want to trim the following text

[i:abcdef]

but the inside text is different at time eg abcdef, bcdefg, etc etc
how can i trim [i:(some text here)] so that i can replace them with nothing.

eg these are to be trimmed.

[i:abcdef]
[i:bcdefg]
[i:xyzab]
[i:priftds]

how can i trim them..
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.

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux