3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function _generateChecksum($eanCodeWithoutChecksum) { $key = 0; $mult = array(1, 3); for ($i = 0; $i < strlen($eanCodeWithoutChecksum); $i++) $key += substr($eanCodeWithoutChecksum, $i, 1) * $mult[$i % 2]; $key = 10 - ( $key % 10 ); if ($key == 10) $key = 0; return $key; } echo _generateChecksum(205240000003);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
4