For the record, in case someone is looking for a PHP solution, you simply do it like this:
<?php echo $_SERVER['REMOTE_ADDR']; ?>
For example, if you were passing it in a JS array, it would look like this:
tr._setSomeVar(5, "Remote Address", "<?php echo $_SERVER['REMOTE_ADDR']; ?>", 9);
source
share