If number ends with 1 do something

Just check the remainder of division by 10:

if (day % 10 == 1) { 
  result = "dan";
} else {
  result = "dana";
}

% is the “Modulo” or “Modulus” Operator, unless you’re using JavaScript, in which case it is a simple remainder operator (not a true modulo). It divides the two numbers, and returns the remainder.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)