# Detecting specific characters in PHP strings

**URL:** <https://forum.kirupa.com/t/detecting-specific-characters-in-php-strings/223587>\
**Category:** Uncategorized\
**Created:** [April 24, 2007, 3:48am UTC](https://forum.kirupa.com/t/detecting-specific-characters-in-php-strings/223587 "2007-04-24T03:48:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lorren\_biffin](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/lorren_biffin/32/2726_2.png) [@lorren\_biffin](https://forum.kirupa.com/u/lorren_biffin)\
**Post date:** [April 24, 2007, 3:48am UTC](https://forum.kirupa.com/t/detecting-specific-characters-in-php-strings/223587/1 "2007-04-24T03:48:27Z")

</div>

EXAMPLE: I’ve got a string that contains the following info:

```auto
$string = "This is just a sample string. Don't take it too litterally. You've got the ca$h.";

```

How do I search the string to find the $ character so I can handle an error(specifically, to restrict specific characters from being entered in a form, and return a custom error message if the user entered in that character)?

Thanks in advance to all of you! 🙂
