String Parse Help for novice

From: Date: Sun, 13 Jun 2010 22:13:42 +0000
Subject: String Parse Help for novice
Groups: php.general 
Request: Send a blank email to php-general+get-306098@lists.php.net to get a copy of this message
Hello List. I need to parse the PATH portion of URL. I have assigned the path portion to a variable using the following: $thepath = parse_url($url); Now I need to break each portion of the path down into its own variable. The problem is, the path can vary considerably as follows: /mydirectory/mysubdirectory/anothersubdirectory/mypage.php vs. /mydirectory/mypage.php How do I get the either of the above url paths broken out so the variables equal the following $dir1 = mydirectory $dir2 = mysubdirectory $dir3 = anothersubdirectory $page = mypage.php ...etc... if there were 5 more subdirectories... they would be dynamically assigned to a variable. Thanks for any help. --Rick

« previous php.general (#306098) next »