$full_name = 'c:\wamp\php\php.ini'; $base = basename($full_name); // $base is "php.ini" $dir = dirname($full_name); // $dir is "c:\wamp\php"