<?php
GMP gmp_neg ( GMP|int|string $num )
where,
$num = Parameter to be turned into negative number
?>
<table width="100%" border="1" cellspacing="5" cellpadding="5">
<tr><td colspan="3">gmp_neg</td></tr>
<tr><td>TYPE<td>VALUE</td><td>NOTE</td></tr>
<?php
$gmp01 = [ 'DECIMAL' => 987654,
'DECIMAL STRING' => '987654',
'OCTAL' => 0123456,
'OCTAL STRING' => '0123456',
'HEXADECIMAL' => 0xFFAAFF,
'HEXADECIMAL STRING' => '0xFFAAFF' ];
/*
You must test other values
These are particular values
*/
foreach($gmp01 as $gm01 => $g01)
{
if(is_string($g01))
{
echo '<td>' . $gm01 . '</td><td>' . gmp_neg($g01) . '</td><td>STRING</td></tr>';
}
else
{
echo '<td>' . $gm01 . '</td><td>' . gmp_neg($g01) . '</td><td>NUMERIC</td></tr>';
}
}
?>
<td colspan="3">ed48</td></tr></table>
gmp_neg($a) You must test other values. These are particular values. | ||
TYPE | VALUE | NOTE |
DECIMAL | -987654 | NUMERIC |
DECIMAL STRING | -987654 | STRING |
OCTAL | -42798 | NUMERIC |
OCTAL STRING | -42798 | STRING |
HEXADECIMAL | -16755455 | NUMERIC |
HEXADECIMAL STRING | -16755455 | STRING |
ed48 |
<?php
// Run this code several times
$bas02 = mt_rand(10,62);
/*
You can set the numeric base for:
$bas02 = 62;
*/
$t02a = 'INTEGER';
$g02a = mt_rand(0, 256);
// DECIMAL INTEGER
$t02b = 'STRING';
$g02b = (string)$g02a;
// DECIMAL STRING
?>
<table width="100%" border="1" cellspacing="5" cellpadding="5">
<tr><td colspan="3">gmp_init / gmp_neg</td></tr>
<tr><td>TYPE<td>EQUIVALENT VALUES</td><td>NOTE</td></tr>
<?php
echo '<td>' . $t02a . '</td><td>( ' . gmp_neg(gmp_init($g02a, $bas02)) . ' )<sub>' . $bas02. '</sub></td><td>NUMERIC</td></tr>';
echo '<td>' . $t02b . '</td><td>( ' . gmp_neg(gmp_init($g02b, $bas02)) . ' )<sub>10</sub></td><td>STRING</td></tr>';
?>
<td colspan="3">ed48</td></tr></table>