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 8589009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:56:28+00:00 2026-06-11T22:56:28+00:00

Why does the following statement return true ? "608E-4234" == "272E-3063" I have also

  • 0

Why does the following statement return true?

"608E-4234" == "272E-3063"

I have also tried this with single quotes around the strings. The only way I can get it to evaulate to false is by using the === operator instead of ==

My guess is PHP is treating it as some sort of equation but it seems a bit of a strange one.

Can anybody elaborate?

  • 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-06-11T22:56:29+00:00Added an answer on June 11, 2026 at 10:56 pm

    "608E-4234" is the float number format, so they will cast into number when they compares.

    608E-4234 and 272E-3063 will both be float(0) because they are too small.

    For == in php,

    If you compare a number with a string or the comparison involves
    numerical strings, then each string is converted to a number and the
    comparison performed numerically.

    http://php.net/manual/en/language.operators.comparison.php

    Attention:

    What about the behavior in javascript which also has both == and ===?

    The answer is the behavior is different from PHP. In javascript, if you compare two value with same type, == is just same as ===, so type cast won’t happen for compare with two same type values.

    In javascript:

    608E-4234 == 272E-3063 // true
    608E-4234 == "272E-3063" // true
    "608E-4234" == 272E-3063 // true
    "608E-4234" == "272E-3063" // false (Note: this is different from PHP)
    

    So in javascript, when you know the type of the result, you could use == instead of === to save one character.

    For example, typeof operator always returns a string, so you could just use

    typeof foo == 'string' instead of typeof foo === 'string' with no harm.

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

Sidebar

Related Questions

I have the following statement in a python routine: return [hulls[h][i] for h, i
Is there any condition under which the following statement PreparedStatement.executeQuery() does not return or
Does the following statement holds for any double (Java primitive double precision IEEE-754) except
What does the following Javascript statement do to a ? a >>>= b;
In the following SQL statement, SQLite sorts correctly but MySQL does not: However, if
(XCode 4.3) Why does the following crash at the NSLog statement with EXC_BAD_ACCESS? BOOL
Why does following code snippet doesn't work? It doesn't gives any error, but also
I'm getting crazy with this IE 7... ==> hhttp://neu.emergent-innovation.com/ Why does following function not
I have a file transfer program. The program (Client) does following operations to send
The following if statement. emptyFields = false; $(.ClassNanme).each(function() { if(($.trim($(this).val()) == ) && ($(this).css('display')

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.