note 111683 added to language.operators.bitwise

From: Date: Sat, 16 Mar 2013 07:59:32 +0000
Subject: note 111683 added to language.operators.bitwise
Groups: php.notes 
Request: Send a blank email to php-notes+get-194092@lists.php.net to get a copy of this message
$a = 9; $b = 10; echo $a & $b; place value 128 64 32 16 8 4 2 1 $a 0 0 0 0 1 0 0 1 =9 $b 0 0 0 0 1 0 1 0 =10 result 8 only bit they share together is the 8 bit. So 8 gets returned. $a = 36; $b = 103; echo $a & $b; place value 128 64 32 16 8 4 2 1 $a 0 0 1 0 0 1 0 0 =36 $b 0 1 1 0 0 1 1 1 =103 result 32+4 = 36 the only bits these two share together are the bits 32 and 4 which when added together return 36. $a = 9; $b = 10; echo $a | $b; place value 128 64 32 16 8 4 2 1 $a 0 0 0 0 1 0 0 1 =9 $b 0 0 0 0 1 0 1 0 =10 result 8+2+1 = 11 3 bits set, in the 8, 2, and 1 column.add those up 8+2+1 and you get 11 $a = 9; $b = 10; echo $a ^ $b; place value 128 64 32 16 8 4 2 1 $a 0 0 0 0 1 0 0 1 =9 $b 0 0 0 0 1 0 1 0 =10 result 2+1 = 3 the 2 bit and the 1 bit that they each have set but don't share. Soooo 2+1 = 3 ---- Server IP: 69.147.83.199 Probable Submitter: 122.167.20.165 ---- Manual Page -- http://php.net/manual/en/language.operators.bitwise.php Edit -- https://master.php.net/note/edit/111683 Del: integrated -- https://master.php.net/note/delete/111683/integrated Del: useless -- https://master.php.net/note/delete/111683/useless Del: bad code -- https://master.php.net/note/delete/111683/bad+code Del: spam -- https://master.php.net/note/delete/111683/spam Del: non-english -- https://master.php.net/note/delete/111683/non-english Del: in docs -- https://master.php.net/note/delete/111683/in+docs Del: other reasons-- https://master.php.net/note/delete/111683 Reject -- https://master.php.net/note/reject/111683 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#194092) next »