<?php
int gmp_intval ( GMP|int|string $num )
where,
$num = The GMP number
to be converted into native PHP INTEGER
?>
<?php
$val01a = PHP_INT_MAX;
$val01b = '922337203685477580711';
echo 'The maximum value accepted by PHP is given by:<br>' . $val01a . '<br><br>gmp_intval( ' . $val01b . ' ) =<br>= ' . gmp_intval($val01b) .
'<br><br>The wrong value because this value is greater than the
maximum value allowed by PHP.<br><br>However,
the actual value can be shown using:<br>gmp_strval( ' . $val01b . ' ) =<br>= ' . gmp_strval($val01b) . '<br><br>';
?>
<?php
$val02a = 13.141_592_653_589_829;
$val02b = 13.141592653589829;
echo '$val02a = ' . $val02a . '<br><br>
gmp_intval( ' . $val02a . ' ) = ' .
gmp_intval($val02a) . '<br><br>';
echo '$val02b = ' . $val02b . '<br><br>
gmp_intval( ' . $val02b . ' ) = ' .
gmp_intval($val02b) . '<br><br>';
/*
This implementation is viable until PHP 7.4.XX,
in PHP 8.0.XX Fatal error is issued
*/
/*
$val02c = '13.141592653589829';
echo '$val02c = ' . $val02c . '<br><br>
gmp_intval( ' . $val02c . ' ) = ' .
gmp_intval($val02c) . '<br><br>';
*/
?>