How to remove the first occurrence of comma from a string in PHP

1 Answer

0 votes
$str = 'c c++, nodejs, python, php java';

$str = preg_replace('/,/', '',  $str, 1);

echo $str;




/*
run:

c c++ nodejs, python, php java

*/

 



answered Apr 17, 2022 by avibootz

Related questions

1 answer 151 views
1 answer 147 views
1 answer 143 views
1 answer 132 views
1 answer 135 views
1 answer 137 views
...