-->

  • PHP numbers with NaN


    PHP numbers with NaN



    PHP Numbers

    You must have noticed one thing that whenever we take the numbers in the identification, then its conversion becomes automatic Or we can say that whatever number we give through Varible, the data type of the number is automatically correct according to its data type.Then, if you assign a string to the same variable, the type will change to a string. PHP numbers with integers

    This automatic conversion can sometimes break your code.


    PHP NaN


    NaN stands for Not a Number.

    NaN is used for impossible mathematical operations.

    PHP has the following functions to check if a value is not a number:


    • is_nan()


    However, the PHP var_dump() function returns the data type and value:

    Example

    Invalid calculation will return a NaN value:


    Example 

    <!DOCTYPE html>
    <html>
    <head>

    <title> PHP numbers with NaN </title>

    </head>
    <body>

    <h1> </h1>


    <?php

    //  check if the type of a variable is integer

    $x = acos(8);

    var_dump($x);

    ?>


    </body>
    </html>





    flaot(NaN)


    NOTE :- From PHP 7.0: The is_numeric() function will return FALSE for numeric strings in hexadecimal form (e.g. 0xf4c3b00c), as they are no longer considered as numeric strings.

    NOTE :- Video on This Topic :- Soon





    Have a Nice Stay Here : - )



  • 0 comments:

    Post a Comment

    For Any Tech Updates, Hacking News, Internet, Computer, Technology and related to IT Field Articles Follow Our Blog.