Hi, I had this working but after a few code revisions it has stopped. I am trying to set a variable; lets say I have $var and am trying to set it to $_SERVER['REMOTE_ADDR'] with the code:

$var = $_SERVER['REMOTE_ADDR'];

When I do this I receive a fatal error in my PHP Debugging program and the page returns blank when you run the script. The error is: Function must be a string. I wasn't getting this before, I have no idea what I did. I might have changed something in my php.ini file because I was playing around with the settings and adjusting them to what I need them to be. So, hence I have no idea what I did, is there any way to set the results (a 4-4 byte ip address) to a string? Thanks. The image is attached or you can view it here: http://12.148.233.90/fatal_error_16.[bmp/jpg]

Recommended Answers

All 2 Replies

You have parenthesis around the REMOTE_ADDR.

It thinks you are trying to call a function with the name of the value of $_SERVER (which is an array) thus causing your "function must be a string" error.

commented: Helped me with a simple function mistake. +1

Oops, thanks for your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.