/    Sign up×
Community /Pin to ProfileBookmark

how to remove letters from <option value="F-firstname" ? Simple question

Hi,
I have code <option value=”F-Zimbabwe” > How to remove letters F- from this this value of variable with PHP?

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@Suhas_DhokeMay 09.2007 — Why not you use the php function [B][COLOR="Blue"]str_replace()[/COLOR][/B] and replace the word [B]F-[/B] with '' (space).
Copy linkTweet thisAlerts:
@toplisekauthorMay 09.2007 — 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?
Copy linkTweet thisAlerts:
@Suhas_DhokeMay 09.2007 — You can use substr() instead of str_replace().

Ex:- [code=php]$string = substr($your_string, $no_of_word_remove)[/code]
Copy linkTweet thisAlerts:
@toplisekauthorMay 09.2007 — Is there easy way to remove 3 letter without publish variable (have many words...)?
Copy linkTweet thisAlerts:
@Suhas_DhokeMay 09.2007 — [code=php]
$option = "'F-Zimbabwe'";
$option = substr($option, 3);
[/code]
Copy linkTweet thisAlerts:
@toplisekauthorMay 09.2007 — thanks, great

Will server notice ,,option'' from my code as variable $option ?
×

Success!

Help @toplisek spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...