hey,
i am having trouble with the php function substr. He's the function that i am working on:
[PHP]
function page_name($url)
{
//this function returns the part of the page name infront of the _
$chunks = explode("/", $url);
$temp = count($chunks);
$res = strpos($chunks[$temp - 1], "_");
if ($res === false)
{
//then we have the index page.
return "index";
}
else
{
//then we have a match.
//it means that the page isn't index.php
//grab everything before the _
$length = strlen($chunks[$temp - 1]);
$numchar = $length - $res;
$length = $length * (-1);
$page = substr($chunks[$temp - 1]), $length, $numchar); //this is the line that has caused the error.
return $page;
}
}
[/PHP]
anyways, when calling this function i send the $PHP_SELF for the url parameter. I get the error:
Quote:
Parse error: parse error, unexpected ',' in /home/nick/CandoWeb-New/menu-split.php on line 30
|
Any ideas?