Unstoppable Domains

Str_replace for the whole word

Spaceship Spaceship
Watch

baris22

Established Member
Impact
1
I want to find and replace some words. the problem is i do not want to replace the words if they are in a word.

forexample this is the sentence:

PHP:
I want to change.

the output should be:

PHP:
I want change.

as you see "an" did not changed in the word "change"
because "an" is not by it self.

PHP:
$short = array('of', 'to', 'in', 'an');
$title = str_replace($short, "", $title);

How can i do this?

Thanks
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
PHP:
$title = str_replace(" ".$short." ", " ", $title);

It's not perfect, but that will do it.
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back