Jump to content

Ascii code breaking in_array

Recommended Posts

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?



Share this post

Link to post
Share on other sites

You don't show any code or error. Is the slash stored in the database as the string '&#047' or as '/'? If you are using regex as the search string you need to escape the slash (i.e. \/).

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.