The code above prouduces the result above.Code:$myVar="abcd ABCD abcd"; $myVar1=str_ireplace("b", "",$myVar); result1 acd ACD acd $myVar2=str_replace("b", "",$myVar); result2 acd ABCD acd
I like to replace "b" just one time.
The would-be code below doesn't work correctly, but I hope it show what I want.
How can I get my target result above?Code:would-be code $myVar3=str_ireplace("b", "",$myVar, 1); target result acd ABCD abcd



Reply With Quote

Bookmarks