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
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
Use str_replace function.
<?php
$result = "GOOD_AFTERNOON-TODAY,FINE";
$shool_name = "test";
$result = str_replace(array(',','-','_'), $shool_name, $result );
echo $result;
?>
output
GOODtestAFTERNOONtestTODAYtestFINE
Check in Editor: Click Here
For AND replace with &.
<?php
$result = "Raichand_International..and..school";
$shool_name = "&";
$result = str_replace(array('and'), $shool_name, $result );
echo $result;
?>
output
Raich&_International..&..school