1--TEST-- 2Test atan2() function : usage variations - different data types as $x arg 3--INI-- 4precision = 10 5--FILE-- 6<?php 7/* Prototype : float atan2 ( float $y , float $x ) 8 * Description: Arc tangent of two variables. 9 * Source code: ext/standard/math.c 10 */ 11 12echo "*** Testing atan2() : basic functionality ***\n"; 13 14//get an unset variable 15$unset_var = 10; 16unset ($unset_var); 17 18// heredoc string 19$heredoc = <<<EOT 20abc 21xyz 22EOT; 23 24// get a class 25class classA 26{ 27} 28 29// get a resource variable 30$fp = fopen(__FILE__, "r"); 31 32$inputs = array( 33 // int data 34/*1*/ 0, 35 1, 36 12, 37 -12, 38 2147483647, 39 40 // float data 41/*6*/ 10.5, 42 -10.5, 43 1.234567e2, 44 1.234567E-2, 45 .5, 46 47 // null data 48/*11*/ NULL, 49 null, 50 51 // boolean data 52/*13*/ true, 53 false, 54 TRUE, 55 FALSE, 56 57 // empty data 58/*17*/ "", 59 '', 60 array(), 61 62 // string data 63/*20*/ "abcxyz", 64 'abcxyz', 65 $heredoc, 66 67 // object data 68/*23*/ new classA(), 69 70 // undefined data 71/*24*/ @$undefined_var, 72 73 // unset data 74/*25*/ @$unset_var, 75 76 // resource variable 77/*26*/ $fp 78); 79 80// loop through each element of $inputs to check the behaviour of atan2() 81$iterator = 1; 82foreach($inputs as $input) { 83 echo "\n-- Iteration $iterator --\n"; 84 var_dump(atan2(23, $input)); 85 $iterator++; 86}; 87fclose($fp); 88?> 89===Done=== 90--EXPECTF-- 91*** Testing atan2() : basic functionality *** 92 93-- Iteration 1 -- 94float(1.570796327) 95 96-- Iteration 2 -- 97float(1.527345431) 98 99-- Iteration 3 -- 100float(1.089909047) 101 102-- Iteration 4 -- 103float(2.051683607) 104 105-- Iteration 5 -- 106float(1.071020961E-8) 107 108-- Iteration 6 -- 109float(1.142532174) 110 111-- Iteration 7 -- 112float(1.99906048) 113 114-- Iteration 8 -- 115float(0.1841885846) 116 117-- Iteration 9 -- 118float(1.570259559) 119 120-- Iteration 10 -- 121float(1.54906062) 122 123-- Iteration 11 -- 124float(1.570796327) 125 126-- Iteration 12 -- 127float(1.570796327) 128 129-- Iteration 13 -- 130float(1.527345431) 131 132-- Iteration 14 -- 133float(1.570796327) 134 135-- Iteration 15 -- 136float(1.527345431) 137 138-- Iteration 16 -- 139float(1.570796327) 140 141-- Iteration 17 -- 142 143Warning: atan2() expects parameter 2 to be double, string given in %s on line %d 144NULL 145 146-- Iteration 18 -- 147 148Warning: atan2() expects parameter 2 to be double, string given in %s on line %d 149NULL 150 151-- Iteration 19 -- 152 153Warning: atan2() expects parameter 2 to be double, array given in %s on line %d 154NULL 155 156-- Iteration 20 -- 157 158Warning: atan2() expects parameter 2 to be double, string given in %s on line %d 159NULL 160 161-- Iteration 21 -- 162 163Warning: atan2() expects parameter 2 to be double, string given in %s on line %d 164NULL 165 166-- Iteration 22 -- 167 168Warning: atan2() expects parameter 2 to be double, string given in %s on line %d 169NULL 170 171-- Iteration 23 -- 172 173Warning: atan2() expects parameter 2 to be double, object given in %s on line %d 174NULL 175 176-- Iteration 24 -- 177float(1.570796327) 178 179-- Iteration 25 -- 180float(1.570796327) 181 182-- Iteration 26 -- 183 184Warning: atan2() expects parameter 2 to be double, resource given in %s on line %d 185NULL 186===Done===