Solved

check if string contains any slashes

Posted on 2010-08-30
4
460 Views
Last Modified: 2012-05-10
How do I check to see if a variable contains any slashes?
0
Comment
Question by:Solutionabc
4 Comments
 
LVL 1

Expert Comment

by:d_j_twilight
ID: 33563355
Are you looking for forward (/) or back (\) slashes or both?
0
 

Author Comment

by:Solutionabc
ID: 33563376
both
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33563391
0
 
LVL 58

Accepted Solution

by:
cyberkiwi earned 500 total points
ID: 33563421
How do I check to see if a variable contains any slashes?

$containsslashes = ((strpos($mystring, "/") === false) && (strpos($mystring, "\\") === false));
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question