3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $asin = "B00ICQMBZG"; if (strlen($asin) == 13) { $odd = 0; $even = 0; $asinChar = str_split("978" . $asin); for ($i = 0; $i < 12; $i++) { if (($i % 2) !== 1) { $odd = $odd + $asinChar[$i]; } else { $even = $even + $asinChar[$i]; } } $sum = $odd + ($even * 3); $i = -1; do { $i++; $checksum = ceil($sum + $i) - $sum; } while (ceil($sum + $i) % 10 != 0); } else { $asinChar = str_split($asin); $num = 0; /** Zehnstellige ISBN Nummern bzw. Asins */ for ($i = 0; $i < 9; $i++) { $num = $num + ($asinChar[$i] * ($i + 1)); } $checksum = fmod($num, 11); } echo "978" . substr($asin, 0, 9) . $checksum;
Output for 7.1.0
Warning: A non-numeric value encountered in /in/7OYaB on line 30 Warning: A non-numeric value encountered in /in/7OYaB on line 30 Warning: A non-numeric value encountered in /in/7OYaB on line 30 Warning: A non-numeric value encountered in /in/7OYaB on line 30 Warning: A non-numeric value encountered in /in/7OYaB on line 30 Warning: A non-numeric value encountered in /in/7OYaB on line 30 Warning: A non-numeric value encountered in /in/7OYaB on line 30 978B00ICQMBZ0
Output for 5.0.0 - 7.0.14
978B00ICQMBZ0
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: str_split() in /in/7OYaB on line 26
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: str_split() in /in/7OYaB on line 26
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: str_split() in /in/7OYaB on line 26