Yesterday I moved a PHP project from Windows to OS X. For reasons of laziness I often code something like:
if (stristr(PHP_OS, "WIN")) { echo "Do something Windows-related here..."; }
This worked usually perfect for scripts moved between Windows and Linux based systems. But one has to be more precise for scripts to run additionally on OS X. Since OS X comes with a PHP_OS string consisting of "Darwin". If you are wondering, why your scripts do not work on Mac try this:
if (stristr(PHP_OS, "Windows")) { echo "Do something Windows-related here..."; }
[...] of server or client detection by checking for a short string anywhere in the fingerprint. This is a good example of why. Comments (0) Comments RSS feed for comments on this post. [...]
What Felix said about assuming... It always seemed like a bad idea to do some kind of server or client detection by checking for a short string anywhere in the fingerprint. This is a good example of why.
Comments closed.
Werbung:
Beiträge von Dritten:
Nachfolgende Titel verweisen auf von mir gelesene Weblogs.
It always seemed like a bad idea to do some kind of server or client detection by checking for a short string anywhere in the fingerprint. This is a good example of why.