Re: Errors in php 5.0.4 Not in 4.3.10-16
- From: myname <none@invalid>
- Date: Wed, 30 Nov 2005 11:15:12 +0100
Han Koster wrote:
I use the following statements:
$var = ""; $var = $_POST('varname');
In php 4, when 'varname' was not defined, $var remained an empty string; In php 5, I suddenly get errors.
I solved these by including the function array_key_exist to check the occurence of 'varname' Is this the prefered way or is ther a better solution?
It depends on php.ini
Do it like this, and you will never see an ugly notice again:
$var = isset($_POST['varname']) ? $_POST['varname'] : ""; .
- References:
- Errors in php 5.0.4 Not in 4.3.10-16
- From: Han Koster
- Errors in php 5.0.4 Not in 4.3.10-16
- Prev by Date: Want Open source Multi- Shoping & CMS Web
- Previous by thread: Errors in php 5.0.4 Not in 4.3.10-16
- Next by thread: Want Open source Multi- Shoping & CMS Web
- Index(es):
Relevant Pages
|