View Single Post
Old 01-04-2012, 06:53 PM   #1 (permalink)
captainmerton
The Acquainted
 
captainmerton's Avatar
 
Join Date: May 2009
Posts: 178
Thanks: 9
captainmerton is on a distinguished road
Default Escaping Commas from a string

I am reading info from a databse for display in html. Issue i have is sometimes the info might have commas in its for example its may say something like:

Bob's New House

Or

Bob's "New" House

When i display in the html its obviously causing issues. I am wondering what the neatest way to handle this is? Assume i can just preg replace " or ' with " but is this the best way to do it for all display in html? Are there other characters ought to cater for and are there any standard php functions to handle this scenario?

Cheers,
Ewan
captainmerton is offline  
Reply With Quote