Jump to content

Archived

This topic is now archived and is closed to further replies.

rajmohan

how to get the last string position?

Recommended Posts

Hai guys i need a help now in my project i want to get the last [b]index.php[/b] from below one (http://localhost/mohan/Aug06/26Aug06/gallery/admin/index.php), not only index.php there are lot of files are there how to get the last one

Share this post


Link to post
Share on other sites
Read up on mod_rewrite for Apache.

And if you are using that as a string within your script, rather than a url:

[code]<?php

$url = 'http://localhost/mohan/Aug06/26Aug06/gallery/admin/index.php';
$page = substr($url, strrpos($url, '/') + 1);

?>[/code]

Share this post


Link to post
Share on other sites
of if you want the page name

$_SERVER['SCRIPT_NAME'];
which will return /index.php

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.