gmp_intval

(PHP 4 >= 4.0.4, PHP 5, PHP 7)

gmp_intvalConvert GMP number to integer

Opis

gmp_intval ( GMP $gmpnumber ) : int

This function converts GMP number into native PHP integers.

Parametry

gmpnumber

Może być zarówno zasobem numeru GMP w PHP 5.5 i wcześniejszych, obiektem klasy GMP w PHP 5.6 i późniejszych lub numerycznym łańcuchem znaków, który można skonwertować z liter do liczb.

Zwracane wartości

The integer value of gmpnumber.

Przykłady

Przykład #1 gmp_intval() example

<?php
// displays correct result
echo gmp_intval("2147483647") . "\n";

// displays wrong result, above PHP integer limit
echo gmp_intval("2147483648") . "\n";

// displays correct result
echo gmp_strval("2147483648") . "\n";
?>

Powyższy przykład wyświetli:

2147483647
2147483647
2147483648

Notatki

Ostrzeżenie

This function returns a useful result only if the number actually fits the PHP integer (i.e., signed long type). To simply print the GMP number, use gmp_strval().

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top