Have an account? Sign in
Login  Register  Facebook
how i can get file name without its extension
i have a zip file \'file-no:50.zip\'
how i can get only file-no:50 with out .zip using the php
Started: September 15, 2011 Latest Activity: September 15, 2011 php file
1 Answer
Check out pathinfo(), it gives you all the components of your path.
Example from the manual:
$path_parts = pathinfo('/www/htdocs/index.html');

echo $path_parts['dirname'], "\n";
echo $path_parts['basename'], "\n";
echo $path_parts['extension'], "\n";
echo $path_parts['filename'], "\n"; // since PHP 5.2.0
and alternatively you can get only certain parts like
echo pathinfo('/www/htdocs/index.html', PATHINFO_EXTENSION); // outputs html

Posted: MacOS
In: September 15, 2011

Your Answer

xDo you want to answer this question? Please login or create an account to post your answer