.
function is_valid_isbn($isbn)
{
$isbn_length = strlen($isbn);
$isbn_sum = 0;
echo "this is the length :";
echo $isbn_length;
for($i=0; $i < $isbn_length; $i++) { $total += (substr($isbn, $i, 1) * (11-($i+1))); }
return true;
}
When i run this function i am getting following error can some one help me where is the err ??
Here is the error message
Parse error: parse error, expecting `';'' in C:\xa开发者_JAVA技巧mpp\htdocs\gbload\application\libraries\Isbnconv.php on line 47Next time, pls tell us where is the line 47. See the fixed code below:
function is_valid_isbn($isbn)
{
$isbn_length = strlen($isbn); //no br here
$isbn_sum = 0;//no br here
echo "this is the length :"; //same
echo $isbn_length;//same
for($i=0; $i < $isbn_length; $i++) //wrong here, missing the operator <
{
$total += substr($isbn, $i, 1) * (11-$i+1); //too many ( )
}//no br here
return true;
}
for($i=0; $i$isbn_length; $i++)
maybe it should be: for($i=0; $i==$isbn_length; $i++)
or something like that...
精彩评论