PDA

View Full Version : Strip excessed characters


AnhTuanCool
02-10-2005, 10:26 PM
Hi all,
I'm looking for a PHP function that can strip off excessed characters. Like I limited $mystring is only 10 characters and if someone enter the value for $mystring over 10 characters, then those excessed characters will be stripped.
Any help would be much appreciated. :)

filburt1
02-10-2005, 11:41 PM
You can either make the corresponding database column VARCHAR(10) or use:

$s = substr($s, 0, 10);

AnhTuanCool
02-10-2005, 11:50 PM
OK, I figured it out now, Thank you filburt1 ;)