Solved

check if string contains any slashes

Posted on 2010-08-30
4
453 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now