Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Add ending slash

    function add_ending_slash($path){

    $slash_type = (strpos($path, '\\')===0) ? 'win' : 'unix';

    $last_char = substr($path, strlen($path)-1, 1);

    if ($last_char != '/' and $last_char != '\\') {
    // no slash:
    $path .= ($slash_type == 'win') ? '\\' : '/';
    }

    return $path;
    }
    Last edited by vinyl-junkie; 06-08-2010 at 01:51 PM. Reason: signatures only allowed through the control panel

  • #2
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    PHP Code:
    $path rtrim$pathDIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR

  • #3
    New Coder
    Join Date
    Jun 2010
    Posts
    20
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by kbluhm View Post
    PHP Code:
    $path rtrim$pathDIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR
    simple and useful


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •