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 362 views
1 answer 225 views
1 answer 251 views
1 answer 273 views
1 answer 349 views
...