<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: EAN13 Barcode Check Digit with PHP</title>
	<atom:link href="http://www.edmondscommerce.co.uk/php/ean13-barcode-check-digit-with-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.edmondscommerce.co.uk/php/ean13-barcode-check-digit-with-php/</link>
	<description>Freelance PHP Ecommerce and SEO Developer in the UK</description>
	<lastBuildDate>Sat, 11 Feb 2012 03:49:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: GioMBG</title>
		<link>http://www.edmondscommerce.co.uk/php/ean13-barcode-check-digit-with-php/comment-page-1/#comment-3774</link>
		<dc:creator>GioMBG</dc:creator>
		<pubDate>Mon, 30 Jan 2012 11:12:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.edmondscommerce.co.uk/blog/php/ean13-barcode-check-digit-with-php/#comment-3774</guid>
		<description>ONLY THANKS!</description>
		<content:encoded><![CDATA[<p>ONLY THANKS!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jerry</title>
		<link>http://www.edmondscommerce.co.uk/php/ean13-barcode-check-digit-with-php/comment-page-1/#comment-3373</link>
		<dc:creator>jerry</dc:creator>
		<pubDate>Sun, 31 Jul 2011 12:36:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.edmondscommerce.co.uk/blog/php/ean13-barcode-check-digit-with-php/#comment-3373</guid>
		<description>Function added by ADMIN is not correct - you need to multiple odd number by 3 not even

$next_ten = (ceil(((3*$odd_sum)+$even_sum)/10))*10</description>
		<content:encoded><![CDATA[<p>Function added by ADMIN is not correct &#8211; you need to multiple odd number by 3 not even</p>
<p>$next_ten = (ceil(((3*$odd_sum)+$even_sum)/10))*10</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://www.edmondscommerce.co.uk/php/ean13-barcode-check-digit-with-php/comment-page-1/#comment-3076</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Fri, 28 Jan 2011 13:17:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.edmondscommerce.co.uk/blog/php/ean13-barcode-check-digit-with-php/#comment-3076</guid>
		<description>Function added by Rémi is not correct, it gives out the wrong result.
However, original function by admin is correct.
Thanks a lot.</description>
		<content:encoded><![CDATA[<p>Function added by Rémi is not correct, it gives out the wrong result.<br />
However, original function by admin is correct.<br />
Thanks a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.edmondscommerce.co.uk/php/ean13-barcode-check-digit-with-php/comment-page-1/#comment-2913</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 14 Oct 2010 14:00:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.edmondscommerce.co.uk/blog/php/ean13-barcode-check-digit-with-php/#comment-2913</guid>
		<description>nice - added syntax highlighting to make it more readable</description>
		<content:encoded><![CDATA[<p>nice &#8211; added syntax highlighting to make it more readable</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rémi</title>
		<link>http://www.edmondscommerce.co.uk/php/ean13-barcode-check-digit-with-php/comment-page-1/#comment-2912</link>
		<dc:creator>Rémi</dc:creator>
		<pubDate>Thu, 14 Oct 2010 13:35:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.edmondscommerce.co.uk/blog/php/ean13-barcode-check-digit-with-php/#comment-2912</guid>
		<description>There is a better way that works with EAN13 and EAN8:
[php]
function get_ean_checkdigit($barcode){
        $sum = 0;
        for($i=(strlen($barcode));$i&gt;0;$i--){
                $sum += (($i % 2) * 2 + 1 ) * substr($barcode,$i-1,1);
        }
        return (10 - ($sum % 10));
}
[/php]
--
Rémi</description>
		<content:encoded><![CDATA[<p>There is a better way that works with EAN13 and EAN8:</p>
<div class="igBar"><span id="lphp-1"><a href="#" onclick="javascript:showPlainTxt('php-1'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-1">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> get_ean_checkdigit<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$barcode</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sum</span> = <span style="color:#CC66CC;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">for</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$i</span>=<span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/strlen"><span style="color:#000066;">strlen</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$barcode</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<span style="color:#0000FF;">$i</span>&amp;gt;<span style="color:#CC66CC;color:#800000;">0</span>;<span style="color:#0000FF;">$i</span>--<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$sum</span> += <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$i</span> % <span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span> * <span style="color:#CC66CC;color:#800000;">2</span> + <span style="color:#CC66CC;color:#800000;">1</span> <span style="color:#006600; font-weight:bold;">&#41;</span> * <a href="http://www.php.net/substr"><span style="color:#000066;">substr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$barcode</span>,<span style="color:#0000FF;">$i</span>-<span style="color:#CC66CC;color:#800000;">1</span>,<span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">10</span> - <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sum</span> % <span style="color:#CC66CC;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
--<br />
Rémi</p>
]]></content:encoded>
	</item>
</channel>
</rss>

