note 126871 added to function.image-type-to-extension
| From: | twitter dot com/jonathansampson at main dot php dot net | Date: | Wed, 23 Feb 2022 03:42:00 +0000 |
| Subject: | note 126871 added to function.image-type-to-extension | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217644@lists.php.net to get a copy of this message | ||
If you would like to get the extension from a filename (string), the following should save you any
frustration with exploding the string into parts (be sure to read the documentation warnings for
pathinfo):
<?php
$filename = "wallpaper.jpg";
$extension = pathinfo( $filename, PATHINFO_EXTENSION );
echo $extension; // "jpg"
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 2600:1700:2ab0:37b8:4476:e9b1:b45b:a3b8)
----
Manual Page -- https://php.net/manual/en/function.image-type-to-extension.php
Edit -- https://main.php.net/note/edit/126871
Del: integrated -- https://main.php.net/note/delete/126871/integrated
Del: useless -- https://main.php.net/note/delete/126871/useless
Del: bad code -- https://main.php.net/note/delete/126871/bad+code
Del: spam -- https://main.php.net/note/delete/126871/spam
Del: non-english -- https://main.php.net/note/delete/126871/non-english
Del: in docs -- https://main.php.net/note/delete/126871/in+docs
Del: other reasons-- https://main.php.net/note/delete/126871
Reject -- https://main.php.net/note/reject/126871
Search -- https://main.php.net/manage/user-notes.php