+ 1

Impossible challenge question.

There's a challenge question to complete the blanks to make a function that returns $x to the power of $y. <?php function p($x,$y){ $res=_; for($i=1;$i<___;$i++){ $res_=$x; } return $res; } ?> The only working solution I find is $x $y * but the first answer space only allows 1 character. The second blank requires 3. The third allows one. I don't see how that's possible. <?php function p($x,$y){ $res=$x; for($i=1;$i<$y;$i++){ $res*=$x; } return $res; } echo p(10,100); ?>

19th May 2017, 11:15 AM
hgfyhcghbn
1 Respuesta
+ 8
<?php function p($x,$y){ $res=1; for($i=1;$i<=$y;$i++){ $res*=$x; } return $res; } ?> is the answer.
19th May 2017, 11:39 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar