View Single Post
Old Apr 6th, 2005, 11:28 AM   #1
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
substr problems.

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?
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote