mwkemo Posted October 21, 2009 Share Posted October 21, 2009 Hello to all, I am having problem with operators. This is my script: if ( $_SERVER["REQUEST_URI"] == "/index.php" ) { echo "URL index.php"; } Ok this is TRUE if index.php is located in root folder, but if I move index.php to, for ex. test folder then this is NOT TRUE because $_SERVER["REQUEST_URI" is /test/index.php. Is there something in php language that replace all letters? Like in linux bash "*". Or is there any other way to do that? Link to comment https://forums.phpfreaks.com/topic/178406-solved-help-with-operators/ Share on other sites More sharing options...
Alex Posted October 21, 2009 Share Posted October 21, 2009 You can use regular expressions in PCRE functions like preg_match() to achieve this. Link to comment https://forums.phpfreaks.com/topic/178406-solved-help-with-operators/#findComment-940797 Share on other sites More sharing options...
salathe Posted October 21, 2009 Share Posted October 21, 2009 Is there something in php language that replace all letters? Like in linux bash "*". Or is there any other way to do that? Sure, perhaps the function fnmatch might be of use. For example: if (fnmatch('*/index.php', $_SERVER['REQUEST_URI'])) { echo "URL index.php"; } Link to comment https://forums.phpfreaks.com/topic/178406-solved-help-with-operators/#findComment-940806 Share on other sites More sharing options...
mwkemo Posted October 21, 2009 Author Share Posted October 21, 2009 Thanks for fast replays. Both solution work great... Link to comment https://forums.phpfreaks.com/topic/178406-solved-help-with-operators/#findComment-940816 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.