lol, that's ok. I can remember being a beginner too.
PHP doesn't require variable initialization. A variable is intialized when it is created, and PHP automatically attempts to figure out what you intend the type to be based on the context with which it is used.
If you compare a variable and it is not initialized PHP will automatically, temporarily, create a copy of the varible in memory with NULL value for comparison purposes, if you aren't using certain language constructs (like isset and empty) PHP may complain in the form of a notice level error which happens with variables, arrays and constants when used before created.
PHP compares most closely with PERL, IMO, while the control structures are very similar to what you would find in C and Java.
Here is easily the most helpful URL you'll need when dealing with PHP:
http://www.php.net/manual/en/
Start at the top, you can probably skip section I, but section II contains basic information about how variables may be used, security, control structures, predefined variables, all the basics. Its pretty dry reading, it doesn't do much hand holding, but there is a wealth of information in there.
That being said, you can get the remote address from the $_SERVER superglobal, which contains a set of predefined variables set by the HTTP SERVER.. the indices in this array aren't gauranteed to be the same between different HTTP servers,
Reference it like this:
echo $_SERVER["REMOTE_ADDR"];
Your script:
$IpAddress = env(REMOTE_ADDR);
The program will look for a user-defined function named 'env' and attempt to pass the constant REMOTE_ADDR to it. Constants in PHP are just like variables, but they can be set only once, do not have a dollar sign, and must be set using the built in define() function. If a constant is used before being set it is assumed the string literal, PHP will complain in the form of a notice level error and continue on with execution. In your case you probably got a fatal error from 'env' not being a defined function.
You can use this script to find variables set in the array:
<?php
phpinfo();
?>
This prints out a detailed output of configuration and enviornment settings.
Additionally, the PHP manual notes those indices which can be expected to appear in the array:
http://www.php.net/manual/en/reserve...riables.server
Here is the specific URL for predefined variables:
http://www.php.net/manual/en/languag...predefined.php
:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::