Don, the problem I have with the value reported by code like this ...
<?php
$im = imagecreatefrompng('nexen.png');
$start_x = 40;
$start_y = 50;
$color_index = imagecolorat($im, $start_x, $start_y);
$color_tran = imagecolorsforindex($im, $color_index);
print_r($color_tran);
... Is that I don't know exactly what it factors in unless I spend considerable time looking up the details of the function calls.
For example, does the value that it returns include the effects of the color profile for the image. I suspect that it doesn't because I don't see any mention of including that as another parameter in any of the function calls or as a global, or as a call to another function. If it doesn't include this, all bets are off because all you are getting are the "uninterpreted" raw values. Of course, color-managed applications like PS will include this and translate the raw values into device-independent values for processing, for passing on to the display profile for conversion to display values, etc.
However, I can tell you this: Prompted by your question, I just did a little test, I took a sRGB JPG image with a very uniform blue sky and read the RGB values for the sky in three color managed photo viewers. The RGB values from all were absolutely identical, so I really don't think there is any problem with PS.
Instead of relying on just the PHP results, check it with other properly color-managed software.
Tom