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
<?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
Comments
Post a Comment
Share this to your friends