Blade Maker Posted November 30, 2009 Posted November 30, 2009 I am calling stuff from my database, and I want to know if when I echo it if I can take out certain characters when I echo it, not from the database but only in the echo, if so how? Quote
a_bertrand Posted November 30, 2009 Posted November 30, 2009 So basically you want that the display displays something different that the database contains? Yes you can, if you have some very well defined rules. For example we could replace all the A with a B: echo str_replace("A","B","AAAAAAA"); You may also try regular expressions in case. Quote
Zero-Affect Posted November 30, 2009 Posted November 30, 2009 a nice filter solution could be something like so // Basically this filters the Variable. // ctype_alnum Simply checks if the variable doesn't contain alpha/numeric chars // ereg_replace simply you replace _ with nothing in the $var // ^this is so it will not recognize the _ to be a issue and then allows _, Alpha and Numeric. $var = (!ctype_alnum(ereg_replace('[_]', '', $var)) ? $var : '' ; echo $var; Hope this helps Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.