Alperen Özdemir Alperen Özdemir - 2 years ago 138
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.

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

Functions used:


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


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download