Rob Avery IV Rob Avery IV - 2 years ago 116
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 (
in Hello). Here would be the end result:

"Hell World!!"

I've tried
, 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 Source
$str="Hello World";
$str1 = substr($str,0,4);
$str2 = substr($str,5,7);
echo $str1.$str2;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download