Jump to content

Need help with PHP Parse error


julian.markov

Recommended Posts

Hi guys,

 

I keep getting the following error:

 

[22-Nov-2010 19:31:01] PHP Parse error:  syntax error, unexpected ';', expecting T_STRING or T_VARIABLE or '{' or '$' in /home/meetano1/public_html/smartway/lib/system.lib(317) : eval()'d code on line 1

 

Here is my code:

 

function parseVariables($file, $echo = 1)
{
	$handle = fopen($file, "r");
	if(!$handle)
	{
	 	return;
	}
	$content = fread($handle, filesize($file));
	fclose($handle);

	$body = $content;
	for($ptr = 0; $ptr < strlen($body); $ptr++)
	{
	    switch($body[ $ptr ])
		{
		 	case "{":
		 	{
				$is_token = 1;
				$token = "";

				break;
		 	}
			case "}":
			{
				$is_token = 0; 

				eval("global \$".strtolower((strpos($token, "[") ? substr($token, 0, strpos($token, "[")) : $token)).";");
				eval("\$sVal = \"$".strtolower($token)."\";");

				$content = str_replace("{{$token}}", "$sVal", $content);

				$token = "";

				break;
			}
		}

	 	if(($body[ $ptr ] != "{" && $body[ $ptr ] != "}") && $is_token)
		{
		 	$token .= $body[ $ptr ];
		}
	}

	if($echo) echo $content;
	else return $content;
}

 

 

I was wondering what could be causing the error. Line 317 is:

 

eval("global \$".strtolower((strpos($token, "[") ? substr($token, 0, strpos($token, "[")) : $token)).";");

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/219526-need-help-with-php-parse-error/
Share on other sites

Archived

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

×
×
  • Create New...

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.