1--TEST-- 2Test pow() function : usage variations - different data types as $exp argument 3--INI-- 4serialize_precision = 14 5--FILE-- 6<?php 7class classA 8{ 9} 10 11// resource variable 12$fp = fopen(__FILE__, "r"); 13 14$inputs = [ 15 // int data 16 0, 17 1, 18 12345, 19 -2345, 20 PHP_INT_MAX, 21 22 // float data 23 2.5, 24 -2.5, 25 12.3456789e10, 26 12.3456789e-10, 27 0.5, 28 29 // null data 30 null, 31 32 // boolean data 33 true, 34 false, 35 36 // empty data 37 "", 38 [], 39 40 // string data 41 "abcxyz", 42 "5.5", 43 "2", 44 "6.3e-2", 45 46 // object data 47 new classA(), 48 49 // resource variable 50 $fp, 51]; 52 53// loop through each element of $inputs to check the behaviour of pow() 54foreach ($inputs as $input) { 55 try { 56 var_dump(pow(20.3, $input)); 57 } catch (Error $e) { 58 echo $e->getMessage(), "\n"; 59 } 60} 61fclose($fp); 62?> 63--EXPECT-- 64float(1) 65float(20.3) 66float(INF) 67float(0) 68float(INF) 69float(1856.6929774279) 70float(0.00053859200856424) 71float(INF) 72float(1.0000000037168) 73float(4.5055521304275) 74float(1) 75float(20.3) 76float(1) 77Unsupported operand types: float ** string 78Unsupported operand types: float ** array 79Unsupported operand types: float ** string 80float(15532029.564086) 81float(412.09) 82float(1.2088495422866) 83Unsupported operand types: float ** classA 84Unsupported operand types: float ** resource 85