<?php $url = "http://www.foo.com/parentfoo/childfoo/"; $last = strrpos($url, '/'); if ($last === false) { return false; } $next_to_last = strrpos($url, '/', $last - strlen($url) - 1); $var1 = substr_replace($url,"",$last); echo $var2 = substr_replace($var1,"#",$next_to_last,1);
You have javascript disabled. You will not be able to edit any code.