|
Posted by Bent Stigsen on 07/17/06 11:29
Tony Marston wrote:
> "Bent Stigsen" <ngap@thevoid.dk> wrote in message
> news:4596685.lTRPzWk8YV@thevoid.dk...
>> Jerry Stuckle wrote:
>>> Bent Stigsen wrote:
>> [snip]
>>> True, I'm not using it in the C sense. But I'm not using "define" in
>>> the Cobol sense, either :-). In PHP, assigning a value to a variable
>>> defines it.
>> That sortof went over my head. Never done Cobol. :)
>> I didn't really consider the subtler differences. Not sure I understand
>> PHP's way anyway. For instance:
>>
>> unset($a);
>> $b = null;
>>
>> "isset" returns false for both $a and $b, even though key of 'b' is
>> present
>> in the $GLOBALS array.
>> Use of $a will generate a notice, but not when using $b.
>>
>> I don't understand the point in that.
>
> You can put a value into a variable without having to define the variable
> beforehand. If you attempt to read from a variable that does not yet exist
> then a ntice is generated. What's so difficult about that?
It's quite clearly stated in the manual, no problem there. I just
don't understand the choice of behavior.
It is the concept of "isset", which I like to take literally.
When I set the variable to null, causing the variable to appear in
$GLOBALS, why should "isset" return false?
I understand the behavior, not the choice.
>>> And it can't be used anyplace other then the left side of
>>> an assignment operator (rvalue in C terms) until it is defined.
>> Not sure I follow.
>
> If it's on the left you are putting a value in, if it's on the right you are
> trying to get a value out.
I gathered that was a typo. Pretty hard to mix up left and right of
Lvalues and Rvalues.
[snip]
>>> My point being - PHP is a different language - and one should be
>>> approaching PHP development differently than C/C++ development.
>> For sure. My oppinion of PHP varies a lot. One day I would consider it a
>> rotting stinking goat carcass which only dogs would take a roll in
>> (figuratively speaking, no offense to dogs), find myself rolling in it the
>> very next day, and cant stand the smell on the third day.
>
> This tells me that you are either using he language incorrectly, or you are
> a pretty poor programmer.
Silly, how would you know how pretty or poor I am?
I don't know if I is incorrect use that flavours my opinion. Hardly a
way to solve the lack of speed. It just isn't for number crunching.
Scope-rules usually annoys me. Behavior of isset bugs me.
This bugs me:
$a = array(1,2,3);
foreach($a as &$val) $val = $val * 2;
foreach($a as $key=>$val) echo "$key = $val\n";
Returns:
0 = 2
1 = 4
2 = 4
Behavior by design, no problem, but I hate when I have to read the
fine print in the manual, if I on top of that find it illogical, then
it is a stinking pile of cow dung.
--
/Bent
Navigation:
[Reply to this message]
|