Question

How can I delete a character from string in PHP ?

$s = "waseem";

Are there a function like delChar($s , 2); ? which 2 is the index of the Character , I search but I didn't find anything . any ideas ?

Was it helpful?

Solution

substr_replace is what you want.

$s = substr_replace($s, '', 2, 1);

OTHER TIPS

$s[2] = '';
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top