How to remove all occurrences of word from a string in PHP

1 Answer

0 votes
$s = "php c# rust java c c++ java java golang python";
$remove = "java";

$s = str_replace($remove, "", $s);

echo $s;


/*
run:

php c# rust  c c++   golang python

*/

 



answered Oct 13, 2024 by avibootz
...