Not sure whether you really want to that in PHP. What you can do is using the .htaccess file to provide such a url transformation.
Otherwise you could do something like this:
if (isset($_GET['dir'])) {
$dir = $_GET['dir'];
header('Location: ' . $dir . '/android.php');
}