3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function checkOGRN($ogrn){ if (strlen($ogrn) == 13) { $verify_num = intval(substr($ogrn, 0, 12)); $check_num = intval(substr($ogrn, -1)); $res_num = $verify_num % 11; } elseif (strlen($ogrn) == 15) { $verify_num = intval(substr($ogrn, 0, 14)); $check_num = intval(substr($ogrn, -1)); $res_num = $verify_num % 13; } else return false; if ($res_num > 9) $res_num = $res_num - round($res_num/10)*10; return ($res_num == $check); } if(checkOGRN('311333426300044')) echo 'OK'; else echo 'Error';
based on v4bSL
Output for 5.0.4 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Undefined variable: check in /in/Nrd44 on line 14 Error
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: check in /in/Nrd44 on line 14 Error