Jack Maessen Jack Maessen - 2 years ago 11270
PHP Question

Eliminating last part of url string in php

I have a url string like this:


echo $_GET['extract']
outputs this:

How can i strip the last file.zip so that

echo $_GET['extract']
outputs this:

Answer Source

Just use dirname - Returns a parent directory's path

echo dirname($_GET['extract'])."/";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download