3v4l.org

run code in 300+ PHP versions simultaneously
<?php function is_ean13($ean13) { if (strlen($ean13) != 13) return 1; // le code-barres doit contenir 13 caractères if (!is_numeric($ean13)) return 2; // le code-barres ne doit contenir que des chiffres // on prend chaque chiffre un par un // si son index (position dans la chaîne en commence à 0 au premier caractère) est impair // on triple sa valeur // on ajoute cette valeur à la somme totale for ($index = 0; $index < 12; $index ++) { $number = (int) $ean13[$index]; if (($index % 2) != 0) $number *= 3; $sum += $number; } $key = $ean13[12]; // clé de contrôle égale au dernier chiffre // la clé de contrôle doit être égale à : 10 - (reste de la division de la somme des 12 premiers chiffres) if (10 - ($sum % 10) != $key) return 3; else return 0; } echo is_ean13(7330510000000);
Output for git.master, git.master_jit
Warning: Trying to access array offset on value of type int in /in/hf4PM on line 15 Warning: Undefined variable $sum in /in/hf4PM on line 17 Warning: Trying to access array offset on value of type int in /in/hf4PM on line 15 Warning: Trying to access array offset on value of type int in /in/hf4PM on line 15 Warning: Trying to access array offset on value of type int in /in/hf4PM on line 15 Warning: Trying to access array offset on value of type int in /in/hf4PM on line 15 Warning: Trying to access array offset on value of type int in /in/hf4PM on line 15 Warning: Trying to access array offset on value of type int in /in/hf4PM on line 15 Warning: Trying to access array offset on value of type int in /in/hf4PM on line 15 Warning: Trying to access array offset on value of type int in /in/hf4PM on line 15 Warning: Trying to access array offset on value of type int in /in/hf4PM on line 15 Warning: Trying to access array offset on value of type int in /in/hf4PM on line 15 Warning: Trying to access array offset on value of type int in /in/hf4PM on line 15 Warning: Trying to access array offset on value of type int in /in/hf4PM on line 20 3
Output for rfc.property-hooks
Warning: Trying to access array offset on int in /in/hf4PM on line 15 Warning: Undefined variable $sum in /in/hf4PM on line 17 Warning: Trying to access array offset on int in /in/hf4PM on line 15 Warning: Trying to access array offset on int in /in/hf4PM on line 15 Warning: Trying to access array offset on int in /in/hf4PM on line 15 Warning: Trying to access array offset on int in /in/hf4PM on line 15 Warning: Trying to access array offset on int in /in/hf4PM on line 15 Warning: Trying to access array offset on int in /in/hf4PM on line 15 Warning: Trying to access array offset on int in /in/hf4PM on line 15 Warning: Trying to access array offset on int in /in/hf4PM on line 15 Warning: Trying to access array offset on int in /in/hf4PM on line 15 Warning: Trying to access array offset on int in /in/hf4PM on line 15 Warning: Trying to access array offset on int in /in/hf4PM on line 15 Warning: Trying to access array offset on int in /in/hf4PM on line 20 3

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
43.62 ms | 403 KiB | 8 Q