Re: How do I access the value of PHP_OS?
| From: | simon at firepages dot org | Date: | Mon, 12 Apr 2004 18:51:10 +0000 |
| Subject: | Re: How do I access the value of PHP_OS? | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-23428@lists.php.net to get a copy of this message | ||
well someone is confused ;) , PHP_OS is a PHP constant , simply
<?echo PHP_OS;?>
Simon Wheeler
firepages
"Luis Moreira" <luis.moreira@esinnovation.pt> wrote in message
news:407509D5.7010808@esinnovation.pt...
> David Scott wrote:
>
> > In the PHP on Windows chapter of Programming PHP, there is mention of
> > a constant, PHP_OS, that can be used to determine the OS running the
> > server that PHP is on.
> >
> > The example code is as follows,
> >
> > <?php
> > if (PHP_OS == "WIN32" || PHP_OS == "WINNT") {
> > define("INCLUDE_DIR","c:\\myapps");
> > } else {
> > // some other platform
> > define("INCLUDE_DIR", "/include");
> > }
> > ?>
> >
> > However, rather than checking this value, I'd like to see if flat out.
> > I tried this,
> >
> > <?php
> > echo "PHP_OS";
> > ?>
> >
> > But it didn't work. How can I see the value contained in this constant?
> >
> There is a lot of confusion on your head.
> That, and you didn't read the whole thing...
> The example MUST include the setting of a variable first, named PHP_OS
> (or better $PHP_OS), and then proceed to the part you show.
>
> If you write
> echo "PHP_OS";
> you are echoing a string, not the contents of a variable.
>
> If you do
> if (PHP_OS == "WIN32" || PHP_OS == "WINNT") {
> you are doing nothing, since PHP_OS is not a variable. It must be
> preceded by a dollar sign.
>
>
>