replace ' _ ' from Social_Science and shown as Social Science using
preg_replace($_GET['category'],'_',' ');
where $_GET['category'] = Socail_Science coming from database
??
How about str_replace()
echo str_replace("_"," ",$_GET['category']);
You need to change the order and you must need to include the regex pattern inside the PHP delimiters.
preg_replace('~_~', ' ', $_GET['category']);
The format of preg_replace
function would be like,
preg_replace($pattern, $replacement, $string);