Okay, so I have this php code that I've been working on and I seem to be getting an error on the very last line of my code which is the "?>". I'll post the code and the error below:

Error:
"Parse error: parse error in C:\wamp\www\Services\VIN.php on line 64"

PHP Code:

<?php
function checkVIN($myVIN)
{
	$alphaNumCheck = true;

	$checkDigit = "";
	$alphaPool = array("","a","b","c","d","e","f","g","h","j","k","l","m","n","p","r","s","t","u","v","w","x","y","z");
	$alphaValue = array("",1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9);
	$digitWeight = array("",8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2);
	$finalWeight = array();
	
	if($alphaNumCheck)
	{
		$aryVinDigit = array();
		for($i = 1; $i <= 17; $i++)
		{
			if($alphaNumCheck)
			{
				$goodAlpha = false;
				for($x = 1; $x <= 23; $x++)
				{
					if($aryVinDigit[$i]==$alphaPool[$x])
					{
						$aryVinValue[$i] = $alphaValue[$x];
						$x = 24;
						$goodAlpha = true;
					}
					
				}
				if(!($goodAlpha))
				{
					$i = 18;
					return false;
				}
			}
			else
			{
				$aryVinValue[$i] = $aryVinDigit[$i];
			}
		}
	$totalWeight = 0;
	for($i = 1; $i <= 8; $i++)
	{
		$finalWeight[$i] = $aryVinValue[$i] * $digitWeight[$i];
		$finalWeight[$i+8] = $aryVinValue[$i+9] * $digitWeight[$i+9];
		$totalWeight = $totalWeight + $finalWeight[$i] + $finalWeight[$i+8];
	}
	$checkDigit = $totalWeight % 11;
	if($checkDigit == 10)
	{
		$checkDigit = "x";
	}
	if($checkDigit = $aryVinDigit[9])
	{
		return true;
	}
	else
	{
		return false;
	}
}

print_r(checkVIN("1M8GDM9AXKP042788"));
?>

Helping me is much appreciated :)

Recommended Answers

All 4 Replies

after line no 63 type end brace " } " for function, before "?>php"
or

line 12 if($alphaNumCheck) is without end brace " } "

U missed out close brace for the function checkVIN

Member Avatar for rajarajan2017

Place a closing brace for the function "}"at line 62

Thanks Guys, Much appreciated!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.