Forum Moderators: coopster

Message Too Old, No Replies

cut characters...

php commands

         

ahmedtheking

11:31 pm on Dec 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there a PHP command, similer to trim, that just cuts characters off if a limit has been reached?

dreamcatcher

11:45 pm on Dec 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



substr will do this for you.

$string = "characters";

$new_string = substr($string, 0,5);

would print just:

chara

For more info check out:
http://www.php.net/manual/en/function.substr.php [php.net]

You can use it to strip from certain points, or from the beginning or end.

dc :)