xref: /PHP-8.0/ext/standard/tests/math/abs_basic.phpt (revision b5c7a83d)
1--TEST--
2Test abs() function : basic functionality
3--INI--
4precision = 14
5--FILE--
6<?php
7echo "*** Testing abs() : basic functionality ***\n";
8
9$values = array(23,
10                -23,
11                2.345e1,
12                -2.345e1,
13                0x17,
14                027,
15                "23",
16                "-23",
17                "23.45",
18                "2.345e1",
19                "-2.345e1",
20                null,
21                true,
22                false);
23
24for ($i = 0; $i < count($values); $i++) {
25    $res = abs($values[$i]);
26    var_dump($res);
27}
28?>
29--EXPECT--
30*** Testing abs() : basic functionality ***
31int(23)
32int(23)
33float(23.45)
34float(23.45)
35int(23)
36int(23)
37int(23)
38int(23)
39float(23.45)
40float(23.45)
41float(23.45)
42int(0)
43int(1)
44int(0)
45