Re: Undefined variable [message #181258 is a reply to message #181257] |
Fri, 26 April 2013 03:27 |
Denis McMahon
Messages: 634 Registered: September 2010
Karma:
|
Senior Member |
|
|
On Thu, 25 Apr 2013 22:05:46 +0200, M. Strobel wrote:
> Am 25.04.2013 20:23, schrieb Denis McMahon:
>> On Thu, 25 Apr 2013 10:10:24 +0200, M. Strobel wrote:
>>
>>> I propose a new reading of "PHP Notice: undefined variable...", it
>>> goes:
>>>
>>> Hey, you are using a variable that is not defined. I will put a
>>> null
>> ..........................................................^^^^
>>
>> *might*
>>
>>> into it.
>>> Because I will make it easy for you.
>>> If you don't care I won't either.
>>
>> + some lines:
>> I may put some random value there instead.
>> The double I use now might not be the string I use next.
>> Or the integer I used last.
>>
>>> Maybe you expected the variable to contain something,
>>> and your app logic will be screwed up.
>>> It will be _a_lot_of_ work to find the error, but that's your
>>> problem.
>>
>> (edited to be more complete and future proof)
>>
>>
> ah, a new community project :-)
>
> I thought (and read) the variables were defined after being accessed,
> but they are not. Very strange decisions of the PHP makers. Console log:
Yes, but that always might change in the next update ;)
I did wonder about:
"The array of doubles I'm using now might not be the class of kitten
hugging monkeys I'll use next week or the tuples of solar hydrogen I used
yesterday."
but that seemed perhaps a little too complex for some of the readers
here. :)
(although the kitten hugging monkeys may be more intelligent than some of
those readers too ... and come to that, so might the tuples of solar
hydrogen)
--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
|
|
|