Use PHP_* CONSTANTS instead of functions to get such values, in order to save a few cycles and for better readability.
I have changed most (except one) php_uname() calls with PHP_OS.
Note that PHP_OS essentially holds only the OS name that php_uname('s') would also return. php_uname() or php_uname('a') would return some more detail, but on a quick search I didn't find anything that would use that extra info, except the one that I reverted in my appended commit.
see http://php.net/manual/en/function.php-uname.php
Testing Instructions
Automatic tests only, should suffice. Release managers please check.
I'm happy to merge the PHP_VERSION and PHP_SAPI stuff. But not comfortable with PHP_OS if i'm honest. It's probably fine - but I don't particuarly want to find out the hard way (especially as you say it's only the sake of a couple of CPU cycles)
So, do we want these optimizations? If yes, I'll resolve those conflicts and we can get this merged. Otherwise, I'll close this.