It has nothing to do with PHP5 specifically. Just use isSet(). Read on for a full explanation.
Sample code:
$first_name = $_REQUEST['first_name'];
The above code example would generate the following type of notice message only when the error_reporting() allows E_NOTICE type of messages (error_reporting is also a php.ini setting):
Notice: Undefined index: first_name in …
Some people are surprised by these notices and think they are out right errors; and they perhaps didn't see the notices when they were testing on their local machine, but see them on their web host providers server (or vice versa). That's because of the difference in 'error_reporting' settings between the two servers. This type of notice messages means that there doesn't seem to be an index entry with 'first_name' and so PHP considers it undefined. One way to prevent this notice is to not assume that an array index is there and check for it specifically first using the isSet() function as in this example:
$first_name = isSet($_REQUEST['first_name']) ? $_REQUEST['first_name'] : '';
This uses the ternary comparison operator. The $first_name variable will be assigned the value of $_REQUEST['first_name'] if it contains something other than NULL. Otherwise, it will be initialized to an empty string (you can set this to be anything you want as a default).
While testing scripts, I recommend that you have the E_NOTICE type of error messages on to help find possible problem areas in your code. Then turn it off before using scripts in a production setting.
Also, this example of code:
$name .= 'Doe';
Will produce the following notice message:
Notice: Undefined variable: name in …
The '.=' is concatenating the 'Doe' to the existing value found in $name. Since the $name variable has not been initialized to something first you may get unpredictable results. Make sure you set/initialize all variables before using the '.=' concatenation assignment. The following code example will not produce the notice since a straight equal assignment is used before the use of '.=':
$name = 'Jane ';
$name .= 'Doe';
echo $name; // Displays Jane Doe