How to remove one character from string by index in PHP

1 Answer

0 votes
$s = "php java c++";

$idx = 4;
 
$s = substr_replace($s, '', $idx, 1);
         
echo $s;



/*
run:

php ava c++

*/

 



answered Jun 20, 2020 by avibootz

Related questions

2 answers 255 views
1 answer 152 views
1 answer 178 views
1 answer 192 views
1 answer 293 views
...