PHP 8.5.0 Alpha 4 available for testing

Voting

: max(zero, zero)?
(Example: nine)

The Note You're Voting On

swedish boy
15 years ago
Here is a quick way of fetching only the filename (without extension) regardless of what suffix the file has.

<?php

// your file
$file = 'image.jpg';

$info = pathinfo($file);
$file_name = basename($file,'.'.$info['extension']);

echo
$file_name; // outputs 'image'

?>

<< Back to user notes page

To Top