1--TEST-- 2Test pow() function : usage variations - different data types as $base argument 3--INI-- 4serialize_precision = 14 5--SKIPIF-- 6<?php 7if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); 8?> 9--FILE-- 10<?php 11 12class classA 13{ 14} 15 16//resource variable 17$fp = fopen(__FILE__, "r"); 18 19$inputs = [ 20 // int data 21 0, 22 1, 23 12345, 24 -2345, 25 PHP_INT_MAX, 26 27 // float data 28 10.5, 29 -10.5, 30 12.3456789e10, 31 12.3456789e-10, 32 0.5, 33 34 // null data 35 null, 36 37 // boolean data 38 true, 39 false, 40 41 // empty data 42 "", 43 [], 44 45 // string data 46 "abcxyz", 47 "5.5", 48 "2", 49 "6.3e-2", 50 51 // object data 52 new classA(), 53 54 // resource variable 55 $fp, 56]; 57 58// loop through each element of $inputs to check the behaviour of pow() 59foreach ($inputs as $input) { 60 try { 61 var_dump(pow($input, 3)); 62 } catch (Error $e) { 63 echo $e->getMessage(), "\n"; 64 } 65} 66fclose($fp); 67 68?> 69--EXPECTF-- 70int(0) 71int(1) 72float(1881365963625) 73float(-12895213625) 74float(9.903520300448E+27) 75float(1157.625) 76float(-1157.625) 77float(1.881676371789%dE+33) 78float(1.881676371789%dE-27) 79float(0.125) 80int(0) 81int(1) 82int(0) 83Unsupported operand types: string ** int 84Unsupported operand types: array ** int 85Unsupported operand types: string ** int 86float(166.375) 87int(8) 88float(0.000250047) 89Unsupported operand types: classA ** int 90Unsupported operand types: resource ** int 91