HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

decoct

Description

The decoct of Math for PHP decimal to octal.

Syntax

decoct(
    int $num
): string

Parameters

num

Decimal value to convert

Negative DecimalPositive DecimalOctal
00
11
22
......
9223372036854775806777777777777777777776
9223372036854775807 (largest signed integer)777777777777777777777
-922337203685477580892233720368547758081000000000000000000000
.........
-2184467440737095516141777777777777777777776
-118446744073709551615 (largest unsigned integer)1777777777777777777777

Return

Octal string representation of num

Examples

1

<?

$num = 0;

$return = decoct($num);

echo $return;
0

2

<?

$num = 1;

$return = decoct($num);

echo $return;
1

3

<?

$num = 2;

$return = decoct($num);

echo $return;
2

4

<?

$num = 9223372036854775806;

$return = decoct($num);

echo $return;
777777777777777777776

5

<?

$num = 9223372036854775807;

$return = decoct($num);

echo $return;
777777777777777777777

6

<?

$num1 = -9223372036854775808;
$num2 = 9223372036854775808;

$return1 = decoct($num1);
$return2 = decoct($num2);

echo $return1 . PHP_EOL
. $return2;

7

<?

$num1 = -2;
$num2 = 18446744073709551614;

$return1 = decoct($num1);
$return2 = decoct($num2);

echo $return1 . PHP_EOL
. $return2;

8

<?

$num1 = -1;
$num2 = 18446744073709551615;

$return1 = decoct($num1);
$return2 = decoct($num2);

echo $return1 . PHP_EOL
. $return2;