Documentation

Ean
in package

Utility class for validating EAN-8 and EAN-13 numbers

Table of Contents

PATTERN  = '/^(?:\d{8}|\d{13})$/'
checksum()  : int
Computes the checksum of an EAN number.
isValid()  : bool
Checks whether the provided number is an EAN compliant number and that the checksum is correct.

Constants

PATTERN

public string PATTERN = '/^(?:\d{8}|\d{13})$/'

EAN validation pattern

Methods

isValid()

Checks whether the provided number is an EAN compliant number and that the checksum is correct.

public static isValid(string $ean) : bool
Parameters
$ean : string

An EAN number

Return values
bool

Search results