Re: Errors in php 5.0.4 Not in 4.3.10-16



Han Koster schrieb:
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?


Thanx,
Han koster



Did you get an error or a notice?
It is neccessary in PHP 5 to declare variables before use them.

-Kirsten
.



Relevant Pages

  • Errors in php 5.0.4 Not in 4.3.10-16
    ... In php 5, I suddenly get errors. ... occurence of 'varname' ... Prev by Date: ...
    (comp.lang.php)
  • Re: Errors in php 5.0.4 Not in 4.3.10-16
    ... In php 5, I suddenly get errors. ... occurence of 'varname' ... Is this the prefered way or is ther a better solution? ...
    (comp.lang.php)
  • Re: Double Dereferencing Question
    ... out how to take a value of a variable, interpret it as a variable name, ... % puts [set $varname] ... proc setvar { ... Even in PHP, where instructors regularly spend time teaching ...
    (comp.lang.tcl)