The following two statements are functionally identical. The bcpowmod() version however, executes in less time and can accept larger parameters.
PHP Code:
<?php
$a = bcpowmod($x, $y, $mod);
$b = bcmod(bcpow($x, $y), $mod);
// $a and $b are equal to each other.
?>