mysql - Parsing out underscore in PHP -
i have script im pulling data form when var_dump($_post)
array(2) { ["objectname"]=> string(7) "testobj" ["object_class"]=> string(12) "object class" } thats fine except want "object_class" "object class" because im trying match string same value wont match because of underscore. how remove it?
str_replace('_', ' ', $variable); edit: overkill if key needed modify, suggesting more general solution.
$newpost = array(); foreach($_post $key => $val) { $newpost[str_replace('_',' ', $key)] = $val; } $_post = $newpost; or along lines.
Comments
Post a Comment