Google+ Followers

Connect

Get Updates Via Email

Enter your email address:

Delivered by FeedBurner

Monday, 1 October 2012

fatal error function name must be a string in php

In this below PHP programming I came across the following error


<?php
$user_ip = $_SERVER('REMOTE_ADDR');
 echo $user_ip;
?>

it  gives the error output in browser as

"fatal error function name must be a string  on line 2"

so after checking that code I used ('REMOTE_ADDR') instead of ['REMOTE_ADDR']

so this could be the error free coding


<?php
$user_ip = $_SERVER ['REMOTE_ADDR'];
 echo $user_ip;
?>

o/p

127.0.0.1