Rob Avery IV Rob Avery IV - 6 months ago 12
PHP Question

php: Delete specific index from string?

I want to be able to specify an index in a string and remove it.

I have the following:

"Hello World!!"


I want to remove the 4th index (
o
in Hello). Here would be the end result:

"Hell World!!"


I've tried
unset()
, but that hasn't worked. I've Googled how to do this and that's what everyone says, but it hasn't worked for me. Maybe I wasn't using it right, idk.

Answer
$str="Hello World";
$str1 = substr($str,0,4);
$str2 = substr($str,5,7);
echo $str1.$str2;