FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Undefined variable
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Undefined variable [message #181265 is a reply to message #181258] Fri, 26 April 2013 19:30 Go to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
Denis McMahon wrote:

> 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.
>>> […]
> […]
>
> 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)

However, the non-trolling reader will observe that the evaluation value of a
reference to an undefined variable actually *is* NULL, and that type
juggling as it occurs e.g. with the “==” operator or a type-converting test
(as opposed to with “===”) is *well-defined* (albeit perhaps unintuitive to
some), in PHP (and other dynamically typed programming languages).

It is simply false that a replacement value will be chosen randomly.

<http://www.php.net/manual/en/language.variables.basics.php>
<http://www.php.net/manual/en/language.types.type-juggling.php>


PointedEars
--
Sometimes, what you learn is wrong. If those wrong ideas are close to the
root of the knowledge tree you build on a particular subject, pruning the
bad branches can sometimes cause the whole tree to collapse.
-- Mike Duffy in cljs, <news:Xns9FB6521286DB8invalidcom(at)94(dot)75(dot)214(dot)39>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Rejecting Certain Non-ASCII Characters
Next Topic: determine a mysqli_result object
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 19:34:09 GMT 2024

Total time taken to generate the page: 0.04854 seconds