On Tue, Aug 24, 2010 at 3:55 PM, Ford, Mike <M.Ford@xxxxxxxxxxxxxx> wrote: >> -----Original Message----- >> From: Andy McKenzie [mailto:amckenzie4@xxxxxxxxx] >> Sent: 24 August 2010 17:24 >> To: php-general@xxxxxxxxxxxxx >> Subject: Re: Bitwise NOT operator? > > >> From your example, this would have shown me what I needed to know: >> >> "Then taking the value of E_NOTICE... >> 1000 >> ... and inverting it via ~: >> 11111111111111111111111111110111" >> >> As it was, I assumed the 32-bit number was there because the author >> wanted it there, not because PHP assumes those extra bits. > > That's not PHP. That's the underlying computer architecture, and PHP has no choice in the matter. (Well, assuming you leave BCMath and so on out of the equation!) > > Cheers! > > Mike True, but largely irrelevant from my point of view: I'm talking to PHP. Even if I'd thought about it in terms of the architecture, I would have assumed that PHP would treat a two-bit number as a two-bit number, even if it had to do some weirdness in the background because it's not. If I enter a decimal two, I know the computer deals with it as binary, and now I know it probably deals with it as a 32-bit binary number, but it doesn't show me all the extra bits: it just shows me a two. My point here, much as it might sound like it, isn't that PHP is wrong for doing things the way it does. Even if I thought it is, I don't know what I'm talking about, and I know it. What I'm saying is that the documentation doesn't even begin to indicate to people like me that things won't work the way we expect. Maybe that's not necessary; certainly I've never needed it until now, and the confusion was easily cleared up. But adding to the docs might avoid a lot of confusion for the next guy who doesn't really know what he's doing. -Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php