Preview:
function modulo11 ($barcode)  {
  $sum = 0;
  for  ( $i=0; $i<=8; $i++ )  {
   $add = $barcode{$i} * ($i+1);
   $sum = $sum + $add; 
  }
  $modulo = $sum % 11;
  if ( $modulo == 10 )  { $modulo = "x"; }
  if ( $barcode{9} == $modulo ) {
   return true;
  } else {
   return false;
  }
} 
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter