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 230 views
1 answer 144 views
1 answer 159 views
1 answer 172 views
1 answer 275 views
...