In the above question the interviewer is expecting the logic behind the scene (Recursive). Actually he may directly ask you to write a recursive function to calculate N to the power of N, or given number to the power of N. Following is the simplest way that you can write a PHP recursive function for this functionality.
function MyPow($r, $w){
if($w==0)
return 1;
else
return MyPow($r, $w-1) * $r;
}
echo MyPow(10, 2);
Also this functionality substitutes by the pow() function in PHP.

