Home
Backend Development
PHP Tutorial
Programming Tips Three Ways to Get File Extensions in PHP_PHP Tutorial



Programming Tips Three Ways to Get File Extensions in PHP_PHP Tutorial
Jul 21, 2016 pm 02:53 PM
extend
file
function
php
one
Small
extension name
Skill
document
method
of
programming
Method 1:
<?php function extend_1($file_name) { $retval=""; $pt=strrpos($file_name, "."); if ($pt) $retval=substr($file_name, $pt+1, strlen($file_name) - $pt); return ($retval); } ?> |
Method 2:
function extend_2($file_name) { $extend = pathinfo($file_name); $extend = strtolower($extend["extension"]); return $extend; } |
Method 3:
function extend_3($file_name) { $extend =explode("." , $file_name); $va=count($extend)-1; return $extend[$va]; } |
Statement of this Website
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

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot tools Tags

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

How To Set Up Visual Studio Code (VS Code) for PHP Development

How do you parse and process HTML/XML in PHP?

PHP Program to Count Vowels in a String

The Key to Coding: Unlocking the Power of Python for Beginners

Java Made Simple: A Beginner's Guide to Programming Power

Create the Future: Java Programming for Absolute Beginners

Problem-Solving with Python: Unlock Powerful Solutions as a Beginner Coder
