Click to See Complete Forum and Search --> : how to remove letters from <option value="F-firstname" ? Simple question
toplisek
05-09-2007, 06:12 AM
Hi,
I have code <option value="F-Zimbabwe" > How to remove letters F- from this this value of variable with PHP?
Suhas Dhoke
05-09-2007, 06:24 AM
Why not you use the php function str_replace() and replace the word F- with '' (space).
toplisek
05-09-2007, 06:37 AM
Hi,
how to do with correct str_replace() if I would like to remove 3 letters from left like F- and not define particular variable to remove this as this function has 3 arguments in code?
Suhas Dhoke
05-09-2007, 06:46 AM
You can use substr() instead of str_replace().
Ex:- $string = substr($your_string, $no_of_word_remove)
toplisek
05-09-2007, 06:48 AM
Is there easy way to remove 3 letter without publish variable (have many words...)?
Suhas Dhoke
05-09-2007, 06:52 AM
$option = "'F-Zimbabwe'";
$option = substr($option, 3);
toplisek
05-09-2007, 06:54 AM
thanks, great
Will server notice ,,option'' from my code as variable $option ?