misterm Posted October 4, 2008 Share Posted October 4, 2008 Hi I wonder if anyone can help with this? I am grabbing the URI of a page like: $thisUri = $_SERVER['REQUEST_URI']; Which works great. Once I have the set $thisUri to the current URI, I want to say if $thisUri starts with "/editor.php?cat=" then do something. The format of the URI will always be like /editor.php?cat=1010000 with the number at the end constantly changing, which is the bit I want to ignore. I've tried using preg_match, but I can't seem to get the syntax right. I'm probably missing something really simple. :/ Thanks to anyone who can point me in the right direction mr m Link to comment https://forums.phpfreaks.com/topic/127055-solved-struggling-with-quotif-starts-withquot-preg_match/ Share on other sites More sharing options...
R0bb0b Posted October 4, 2008 Share Posted October 4, 2008 you could try <?php if(substr($_SERVER['REQUEST_URI'], 0, 16) == "/editor.php?cat=") { } ?> Link to comment https://forums.phpfreaks.com/topic/127055-solved-struggling-with-quotif-starts-withquot-preg_match/#findComment-657227 Share on other sites More sharing options...
misterm Posted October 4, 2008 Author Share Posted October 4, 2008 Thanks ever so much R0bb0b That works a treat and is much simpler than what I was trying. mr m Link to comment https://forums.phpfreaks.com/topic/127055-solved-struggling-with-quotif-starts-withquot-preg_match/#findComment-657231 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.