Hi all. Quick question about arrays and two of the Posix functions.
I want to create two named constants, one containing the owner of the currently executing file, one for the group to which that owner belongs.
I've set the following var for the currently executing file:
$f = $HTTP_SERVER_VARS["PATH_TRANSLATED"];
However, the functions I need to use to get the owner and group info,
posix_getpwuid(fileowner($f))
and
posix_getgrgid(filegroup($f))
both return arrays, and named constants can only evaluate to scalar values.
So, I'm using the following:
define("owner",implode("",array_slice(posix_getpwuid(fileowner($f)),0,1)));
define("group",implode("",array_slice(posix_getgrgid(filegroup($f)),0,1)));
which assigns the two constants the proper values.
Other than assigning the results of the posix functions to two variables, is there a more effective way to access the individual elements of their respective arrays other than what I've done above with implode and array_slice?
Any thoughts?
Thanks in advance,
Pablo