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); ?> Link to comment https://forums.phpfreaks.com/topic/239055-remove-everything-after-the-last-symbol/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.