Posted by Emil on 11/18/41 11:44
Kimmo Laine napisał(a):
>> $var = isset($_POST['postvar']) ? $_POST['postvar'] . 'default value';
>>
I have the same problem.
>
> And tell mme again why you couldn't write a function instead of a macro to
> do that?
The reason is when you pass $_POST['postvar'] to a function and
$_POST['postvar'] is not set, PHP generates warning. Of course one could
turn off warnings and usually does, but in my opinion it's not a
solution. However checking everytime if variable (or array index) is set
before passing it to a function generates sometimes tones of similar
code which could be simply replaced with one elegant macro.
Maybe it's just a matter of programmer's habit, I feel lack of macros.
Greetz Emil
Navigation:
[Reply to this message]
|