1
EAN-13 is a barcode in the EAN standard defined by GS1, adapted in more than one hundred GS1 member organizations, for the identification of items, mainly at retail or retail outlets around the world, with the exception of North America where the UPC barcode is used.
I needed a function to calculate the EAN-13 DV, mentioned in the above section. At the time I looked everywhere and found nothing about it.
After getting a solution, I came to share here on the site, follows in the field of answers.
Alternatively, you can add
$code = strval($code);
in the first line of the function. Demonstration by passing the value as integer: https://ideone.com/PN9EHN– Bacco