Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php replace special character from the variable value

Tags:

php

I have a variable

$school_name;

It's fetching many data from the server and I want to replace comma, underscore and dash to the variable value and echo but the problem is I can't replace it Please support for fix the bug Thank you

like image 329
Gourab Mazumder Avatar asked Dec 29 '25 20:12

Gourab Mazumder


1 Answers

Use str_replace like this

$result = str_replace(array(',','-','_'), $shool_name, $yourStringFromServer);

Hope this helps.

like image 168
Mubashar Abbas Avatar answered Dec 31 '25 13:12

Mubashar Abbas