Jaijai Posted June 23, 2020 Share Posted June 23, 2020 Hello everyone, I am trying to see if a term, sent from a form, is in an array that has been pulled from the database. The problem I am having is that while the terms look the same the one from the database is using an Ascii character for a forward slash. & # 047 ; I have tried adding the Ascii to the form value but it just rendered as a forward slash (no surprises there I suppose) So the main reason for asking is that for all the other items in the form I can use in_array. This keeps things really tidy and easy to use. Any ideas how I can still use in_array and get around the Ascii problem? Cheers Ian Quote Link to comment https://forums.phpfreaks.com/topic/310983-ascii-code-breaking-in_array/ Share on other sites More sharing options...
gw1500se Posted June 23, 2020 Share Posted June 23, 2020 You don't show any code or error. Is the slash stored in the database as the string '/' or as '/'? If you are using regex as the search string you need to escape the slash (i.e. \/). Quote Link to comment https://forums.phpfreaks.com/topic/310983-ascii-code-breaking-in_array/#findComment-1579092 Share on other sites More sharing options...
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.