sepoto Posted March 1, 2011 Share Posted March 1, 2011 I have a string like this:$c = $_SERVER["REMOTE_ADDR"];So in memory the string actually looks in human form like this "192.168.1.1".What I want to do is create an if something in pseudo code like this:if($c == "192.168.%.%") { //Where % is wildcard could be anything at all Ignore it};How could I go about accomplishing a task like this?Thanks! Link to comment Share on other sites More sharing options...
Ingolme Posted March 1, 2011 Share Posted March 1, 2011 That's what regular expressions are for.You can use preg_match for it: if(preg_match('/192\.168\.\d{0,3}\.\d{0,3}/',$c)) { // Ignore} Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.