$_SERVER(‘REMOTE_ADDR’) Fatal error: Function name must be a string in:

Posted on:

December 3rd, 2009

This will be a Homer Simpson “doh” moment for you as much as it was for me. When calling Super Global Variables you have to use “[]” instead of “()”.

The code should look something like this:

echo "Your IP address is: " . $_SERVER['REMOTE_ADDR'];

The reason why you have to use [] instead of () is that the $_SERVER variable is an array and not an object/function. Hope this helps!

Leave a Reply