Skip to content

Instantly share code, notes, and snippets.

@richo
Last active December 14, 2015 05:49
Show Gist options
  • Save richo/5037746 to your computer and use it in GitHub Desktop.
Save richo/5037746 to your computer and use it in GitHub Desktop.
elektra ⚡ php test_pwuid.php
Uname: Darwin
Username: richo
elektra ⚡
elektra ⚡ /usr/bin/php test_pwuid.php
Uname: Darwin
Username: richo
elektra ⚡
vagrant@precise64:~$ php test_uid.php
Uname: Linux
Username: vagrant
vagrant@precise64:~$
<?php
$uname = posix_uname();
printf("Uname: %s\n", $uname["sysname"]);
$uid = getmyuid();
$passwd = posix_getpwuid($uid);
printf("Username: %s\n", $passwd["name"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment