trekerboy Posted September 2, 2007 Share Posted September 2, 2007 Hello, I am trying to write a snippet of code that will get the parent directory of a given string. For example, the string might be $string = "/public_html/images/" and I need something that will return "/public_html/". Any advice is appreciated! - Jason Quote Link to comment https://forums.phpfreaks.com/topic/67595-solved-how-to-get-parent-directory-from-string/ Share on other sites More sharing options...
trekerboy Posted September 2, 2007 Author Share Posted September 2, 2007 Got it. Use dirname($string) Quote Link to comment https://forums.phpfreaks.com/topic/67595-solved-how-to-get-parent-directory-from-string/#findComment-339567 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.