Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6870103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:38:30+00:00 2026-05-27T03:38:30+00:00

My understanding is… if is_numeric($input) === true then either is_float($input) === true OR is_int($input)

  • 0

My understanding is…

if is_numeric($input) === true

then either

is_float($input) === true OR

is_int($input) === true OR

$input === 0 OR

$input is a numeric string (meaning it’d satisfy one of the first 3 if it weren’t wrapped in quotes).

Is that accurate? Are there other differences?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:38:31+00:00Added an answer on May 27, 2026 at 3:38 am

    See PHP’s documentation on is_numeric. It talks about everything that is allowed, and it’s more than is_float and is_int.


    It’s also important to note that is_int only works on things that are type integer, meaning string representations are not allowed. This is a common problem when verifying that form input is an integer. You should use filter_var or something from the filter family with the filter FILTER_VALIDATE_INT. For floats, use FILTER_VALIDATE_FLOAT.


    Also, if the reason you are trying to check for an integer is to validate a parameter as being an int, then in PHP 7 you can do this:

    function foo(int $i) {
        // $i is guaranteed to be an int (is_int) will be true
    }
    

    PHP 7 has two different modes for converting to int; this answer explains it a bit more.

    Note that this is probably not what you want if you are validating the contents of a form element. Use the filter_var solution for that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After understanding (quote), I'm curious as to how one might cause the statement to
My understanding is that Processing.js converts Processing code into javascript. But if one does
My understanding: Mercurial has three levels of config files: one shared by all users
Understanding that if someone had JavaScript disabled the site would not work then is
My understanding of XSS attacks focused on people entering malicious input via forms (persistant
My understanding is that one of the fundamental concepts in WPF is that it
My understanding of constructor chaining is that , when there are more than one
My understanding is that hasOwnProperty returns true if the object has a given member
Understanding that I should probably just dig into the source to come up with
Understanding the difference between throw ex and throw , why is the original StackTrace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.