Hey everyone,

  I'm really not sure what's going on here:  basically, the bitwise
NOT operator seems to simply not work.  Here's an example of what I
see.

============Script============

$ cat bintest2.php

<?php

$bin = 2;
$notbin = ~$bin;

echo "Bin: " . decbin($bin) . "  !bin:  " . decbin($notbin) . "\n";
echo "Bin: $bin  !bin:  $notbin\n";


?>
=============================


============Output============

$ php bintest2.php
Bin: 10  !bin:  11111111111111111111111111111101
Bin: 2  !bin:  -3

=============================


Obviously that's not the expected response.  I expect to get something
more like this:

Bin: 10  !bin:  01
Bin: 2  !bin:  1


Can anyone shed some light on this for me?  The server is running an
old version of OpenSUSE, and php --version returns:

PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Dec 12 2007 03:51:56)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies


I get the same response on an Ubuntu 8.04 LTS server with PHP
5.2.4-2ubuntu5.10 with Suhosin-Patch 0.9.6.2.

Thanks in advance,

  Alex McKenzie
  amckenz...@gmail.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to