While it's quite easy and intuitive to get the alpha transparency of a pixel with:
<?php
$rgba = imagecolorsforindex($image, imagecolorat($image, $x, $y));
$alpha = $rgba["alpha"];
?>
you should use the return value of the command imagecolorat to get the alpha transparency with the code below because it's much faster and will have a major impact if you process every pixel of an image:
<?php
$rgba = imagecolorat($image, $x, $y);
$alpha = ($rgba & 0x7F000000) >> 24;
?>