php - File extension without dot (period symbol) -
my code
<?php $video_thumb_large = 'some.example-file.name.png'; /** define file name here **/ /** line below giving me need **/ $video_thumb_extension_large = substr($video_thumb_large, strrpos($video_thumb_large, '.') + 1); echo $video_thumb_extension_large; /** output: png **/ ?>
there other methods file extension, example this stack overflow question has answers code not available in answers.
i'm wondering why code or bad , why or why not use code on production site. better in case? can use explode()
on dot , use last part in array()
better?
what better or best file extension without dot (.)?
recommended own experience, faster basename, explode or using own func.
try use default php func cachable in opcaches..
recoded replace old code , execute
<?php //recoded ajmal praveen $video_thumb_large = 'some.example-file.name.png'; /** define file name here **/ $path_parts = pathinfo($video_thumb_large); //out file name , file extension without dot echo 'file name :'; echo $path_parts['filename']; echo '<br>'; echo 'file extension :'; echo $path_parts['extension']; echo '<br>'; ?>
Comments
Post a Comment