Octal To Decimal

This algorithm converts octal numbers to decimal numbers.



									function OctalToDecimal($octal)
{
	$octLength = strlen($octal);
	$dec = 0;

	for ($i = 0; $i < $octLength; $i++)
	{
		$dec += (ord($octal[$i]) - 48) * pow(8, (($octLength - $i) - 1));
	}

	return (int)$dec;
}
								


Example

									$data = "2430357";
$value = OctalToDecimal($data);
								


Output

									667887