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 #181257 is a reply to message #181256] Thu, 25 April 2013 20:05 Go to previous messageGo to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
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:

> echo $a, PHP_EOL;
PHP Notice: Undefined variable: a in /usr/local/bin/myreadline.php(42) : eval()'d
code on line 1

> var_dump($a);
PHP Notice: Undefined variable: a in /usr/local/bin/myreadline.php(42) : eval()'d
code on line 1
NULL
> if ($a==0.0) echo "yes\n";
PHP Notice: Undefined variable: a in /usr/local/bin/myreadline.php(42) : eval()'d
code on line 1
yes
> var_dump($a);
PHP Notice: Undefined variable: a in /usr/local/bin/myreadline.php(42) : eval()'d
code on line 1
NULL

/Str.
[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:41:56 GMT 2024

Total time taken to generate the page: 0.03779 seconds