Return to abs_basic.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / math |
1.1 misho 1: --TEST-- 2: Test abs() function : basic functionality 3: --INI-- 4: precision = 14 5: --FILE-- 6: <?php 7: /* Prototype : number abs ( mixed $number ) 8: * Description: Returns the absolute value of number. 9: * Source code: ext/standard/math.c 10: */ 11: 12: echo "*** Testing abs() : basic functionality ***\n"; 13: 14: $values = array(23, 15: -23, 16: 2.345e1, 17: -2.345e1, 18: 0x17, 19: 027, 20: "23", 21: "-23", 22: "23.45", 23: "2.345e1", 24: "-2.345e1", 25: null, 26: true, 27: false); 28: 29: for ($i = 0; $i < count($values); $i++) { 30: $res = abs($values[$i]); 31: var_dump($res); 32: } 33: ?> 34: ===Done=== 35: --EXPECTF-- 36: *** Testing abs() : basic functionality *** 37: int(23) 38: int(23) 39: float(23.45) 40: float(23.45) 41: int(23) 42: int(23) 43: int(23) 44: int(23) 45: float(23.45) 46: float(23.45) 47: float(23.45) 48: int(0) 49: int(1) 50: int(0) 51: ===Done===