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

Home » Imported messages » comp.lang.php » loose thinking
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: loose thinking [message #176798 is a reply to message #176797] Wed, 25 January 2012 19:37 Go to previous messageGo to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
Peter H. Coffin wrote:

> On Wed, 25 Jan 2012 04:49:19 +0100, Thomas 'PointedEars' Lahn wrote:
>> Peter H. Coffin wrote:
>>> On Tue, 24 Jan 2012 14:32:52 +0100, M. Strobel wrote:
>>>> Okay I see it is well documented. I just started testing.
>>>>
>>>> I am angry about it because not even isset() respects the null value
>>>> here. I think it makes more sense this way: isset($a[null]) should
>>>> return false, because there is no null index.
>>> Parens change precedence. Even on functions.
>>
>> You are missing the point, which is: `null' is being converted to the
>> primitive string value ''. A key of an *associative* array may be the
>> empty string. And that is good so.
>
> That's the *same point*, not "missing the point". I'm sorry that I'm not
> wandering down the same mental path would, but I don't think in exactly
> the same terms you do. Not everybody does.

I do not follow. Please explain why you think (operator) precedence has
something to do with this problem.

>> What is questionable here is the implicit type conversion of non-numeric
>> values to string. But PHP is not alone there, so this behavior can be
>> expected. It might be nice if E_STRICT reported such spurious
>> conversions
>> or there was an even stricter mode that forbade them. Perhaps in PHP 6
>> ???

There were no question marks in my posting, there was an ellipsis. Please
get a working newsreader; Unicode and UTF-8 are anything but new or exotic
nowadays.

> null's a special case that's NOT reported. Other cases of this are
> reported.
>
> hellsop /home/hellsop
> [07:57:10] $ cat foo.php
> <?php
>
> $arr = array( q => 'r');
>
> print_r($arr);
>
> ?>
> hellsop /home/hellsop
> [07:57:12] $ php -f foo.php
> PHP Notice: Use of undefined constant q - assumed 'q' in
> /home/hellsop/foo.php on line 3

Please notice that this is only a notice.

> Array
> (
> [q] => r
> )
> hellsop /home/hellsop
> [07:57:15] $

Because `null' is a reserved word, thus cannot be the identifier of a
constant. Where `null' is the value of another expression (like a variable
reference), PHP shows its being influenced by C, Perl and Tcl, and its
applicability as a shell scripting language, where (with the exception of C)
loose typing is common and you do not have to declare variables before you
refer to them.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
[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
Previous Topic: Open Source Customization
Next Topic: Product page getting Redirect back to Home page - Please Fix
Goto Forum:
  

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

Current Time: Sat Nov 30 09:15:26 GMT 2024

Total time taken to generate the page: 0.04324 seconds