matthew9090 Posted June 11, 2011 Share Posted June 11, 2011 lets say i have this string: dir/dir/dir/dir/dir how would i remove everything after the last '/' sign so it outputs this: dir/dir/dir/dir (and removes the '/' symbol aswell) <?php //something like this $str = "dir/dir/dir"; $replace = //do something echo $replace; ?> EDIT: i found the solution <?php $str = "dir/dir/dir"; $replace = dirname($str); ?> Quote Link to comment 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.