www.webdeveloper.com
Results 1 to 4 of 4

Thread: [RESOLVED] PHP IF Variable Contains...

Hybrid View

  1. #1
    Join Date
    Jul 2012
    Posts
    32

    resolved [RESOLVED] PHP IF Variable Contains...

    How Can I Set Up An If Statement To Check If A Variable Contains These Characters?
    Code:
    \/:*?"<>|
    I Have The Character Filter On JavaScript Figured Out But i Want Both checking it.
    Thank, You!!!

  2. #2
    Join Date
    Jan 2004
    Posts
    484
    do you mean Variable value?

    if so use preg_match

    PHP Code:
    preg_match('/[\'\/~`\!@#\$%\^&\*\(\)_\-\+=\{\}\[\]\|;:"\<\>,\.\?\\\]/'$haystack
    Natdrip :P
    "water go down the hole" - plucky duck

  3. #3
    Join Date
    Jul 2012
    Posts
    32

    Thumbs up Thank You!!!

    Quote Originally Posted by Natdrip View Post
    do you mean Variable value?

    if so use preg_match

    PHP Code:
    preg_match('/[\'\/~`\!@#\$%\^&\*\(\)_\-\+=\{\}\[\]\|;:"\<\>,\.\?\\\]/'$haystack
    I Got That To Work Awesomely, Thank You So Much

  4. #4
    Join Date
    Jan 2009
    Posts
    3,346
    Quote Originally Posted by iGeekiHackiMatt View Post
    How Can I Set Up An If Statement To Check If A Variable Contains These Characters?
    Code:
    \/:*?"<>|
    I Have The Character Filter On JavaScript Figured Out But i Want Both checking it.
    Thank, You!!!
    If you have a regex you are using in Javascript you can use preg_match in PHP with the same string.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles