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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.