Solved

check if string contains any slashes

Posted on 2010-08-30
4
441 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
Comment Utility
Are you looking for forward (/) or back (\) slashes or both?
0
 

Author Comment

by:Solutionabc
Comment Utility
both
0
 
LVL 65

Expert Comment

by:rockiroads
Comment Utility
0
 
LVL 58

Accepted Solution

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

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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

743 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

13 Experts available now in Live!

Get 1:1 Help Now