Reputation: 27
how might I be able to do this?
I'm familiar with the str operators, but am pretty unsure how might I be able to do this.
Logic test:
If (string.contains == '+') {
string.change("test");
}
Basically what it's needed for:
it'll be used for a string that contains more then just a + e.g. hello+hello will change into -> hellotesthello
Upvotes: 0
Views: 93
Reputation: 7005
if(strpos($string, '+') !== false){
$string = 'test';
}
If you want to change the +
into test
you would use
$string = str_replace('+', 'test', $string);
Upvotes: 2