1--TEST-- 2Test variations in usage of sqrt() 3--INI-- 4precision = 14 5--FILE-- 6<?php 7/* 8 * proto float sqrt(float number) 9 * Function is implemented in ext/standard/math.c 10*/ 11 12 13//Test sqrt with a different input values 14echo "*** Testing sqrt() : usage variations ***\n"; 15 16$values = array(23, 17 -23, 18 2.345e1, 19 -2.345e1, 20 0x17, 21 027, 22 "23", 23 "23.45", 24 "2.345e1", 25 "nonsense", 26 "1000", 27 "1000ABC", 28 null, 29 true, 30 false); 31 32for ($i = 0; $i < count($values); $i++) { 33 $res = sqrt($values[$i]); 34 var_dump($res); 35} 36 37?> 38===Done=== 39--EXPECTF-- 40*** Testing sqrt() : usage variations *** 41float(4.7958315233127) 42float(NAN) 43float(4.8425200051213) 44float(NAN) 45float(4.7958315233127) 46float(4.7958315233127) 47float(4.7958315233127) 48float(4.8425200051213) 49float(4.8425200051213) 50 51Warning: sqrt() expects parameter 1 to be double, string given in %s on line %d 52NULL 53float(31.622776601684) 54 55Notice: A non well formed numeric value encountered in %s on line %d 56float(31.622776601684) 57float(0) 58float(1) 59float(0) 60===Done=== 61