Home  >  Article  >  Backend Development  >  How to remove file name suffix in php

How to remove file name suffix in php

藏色散人
藏色散人Original
2020-08-31 10:22:442356browse

php How to remove the suffix of a file name: First create a PHP sample file; then specify a file name; finally remove the suffix of the specified file name through functions such as "str_replace".

How to remove file name suffix in php

Recommendation: "PHP Video Tutorial"

php remove file name suffix (extension):

<?php 
$filename="help.php"; 
$filename=str_replace(strrchr($filename, "."),"",$filename); 
echo $filename; 
?>

Output:

help

The above is the detailed content of How to remove file name suffix in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn