1--TEST-- 2Test atan2() function : usage variations - different data types as $y 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() : usage variations ***\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($input, 23)); 85 $iterator++; 86}; 87 88fclose($fp); 89?> 90===Done=== 91--EXPECTF-- 92*** Testing atan2() : usage variations *** 93 94-- Iteration 1 -- 95float(0) 96 97-- Iteration 2 -- 98float(0.04345089539) 99 100-- Iteration 3 -- 101float(0.4808872802) 102 103-- Iteration 4 -- 104float(-0.4808872802) 105 106-- Iteration 5 -- 107float(1.570796316) 108 109-- Iteration 6 -- 110float(0.4282641529) 111 112-- Iteration 7 -- 113float(-0.4282641529) 114 115-- Iteration 8 -- 116float(1.386607742) 117 118-- Iteration 9 -- 119float(0.0005367682093) 120 121-- Iteration 10 -- 122float(0.02173570684) 123 124-- Iteration 11 -- 125float(0) 126 127-- Iteration 12 -- 128float(0) 129 130-- Iteration 13 -- 131float(0.04345089539) 132 133-- Iteration 14 -- 134float(0) 135 136-- Iteration 15 -- 137float(0.04345089539) 138 139-- Iteration 16 -- 140float(0) 141 142-- Iteration 17 -- 143 144Warning: atan2() expects parameter 1 to be float, string given in %s on line %d 145NULL 146 147-- Iteration 18 -- 148 149Warning: atan2() expects parameter 1 to be float, string given in %s on line %d 150NULL 151 152-- Iteration 19 -- 153 154Warning: atan2() expects parameter 1 to be float, array given in %s on line %d 155NULL 156 157-- Iteration 20 -- 158 159Warning: atan2() expects parameter 1 to be float, string given in %s on line %d 160NULL 161 162-- Iteration 21 -- 163 164Warning: atan2() expects parameter 1 to be float, string given in %s on line %d 165NULL 166 167-- Iteration 22 -- 168 169Warning: atan2() expects parameter 1 to be float, string given in %s on line %d 170NULL 171 172-- Iteration 23 -- 173 174Warning: atan2() expects parameter 1 to be float, object given in %s on line %d 175NULL 176 177-- Iteration 24 -- 178float(0) 179 180-- Iteration 25 -- 181float(0) 182 183-- Iteration 26 -- 184 185Warning: atan2() expects parameter 1 to be float, resource given in %s on line %d 186NULL 187===Done===