Alperen Özdemir Alperen Özdemir - 7 months ago 51
PHP Question

PHP Parsing From Right

I have a string like $filename = "" and I want to parse it and take just "zip" part from the string. I spend 3 hours on However, I couldn't found any method. By the way, there is not just a string, there are lots of variables.

$a = explode('.', $filename );
echo end($a);

Functions used:


$last_three_chars = substr( $filename, -3 );
echo $last_three_chars ;