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