You are here

function pet_is_natural in Previewable email templates 6

Same name and namespace in other branches
  1. 8.4 pet.module \pet_is_natural()
  2. 8 pet.module \pet_is_natural()
  3. 7 includes/pet.admin.inc \pet_is_natural()

Return TRUE if a $val is a natural number (integer 1, 2, 3, ...). Base can be changed to zero if desired.

1 call to pet_is_natural()
pet_user_form in ./pet.admin.inc
Multi-step PET form.

File

./pet.admin.inc, line 596
Contains administrative pages for creating, editing, and deleting previewable email templates (PETs).

Code

function pet_is_natural($val, $base = 1) {
  if (!isset($val)) {
    return FALSE;
  }
  $return = (string) $val === (string) (int) $val;
  if ($return && intval($val) < $base) {
    $return = FALSE;
  }
  return $return;
}