note 106123 added to language.operators.bitwise

From: Date: Wed, 12 Oct 2011 14:56:00 +0000
Subject: note 106123 added to language.operators.bitwise
Groups: php.notes 
Request: Send a blank email to php-notes+get-183829@lists.php.net to get a copy of this message
To make very clear why ("18" & "32") is "10". 1) they they are both strings , 2) "&" operator works on strings by taking each !Character! from each string and make a bit wise & between them and add this value to the resulting string So: "18" is made up of two characters: 0x31, 0x38 "32" is made up of two characters: 0x33, 0x32 ----RESULT----- 0x31 & 0x33 = 0x31 => "1" 0x38 & 0x32 = 0x30 => "0" and the result is "10" which is 100% correct. ---- Server IP: 69.147.83.197 Probable Submitter: 113.89.110.15 ---- Manual Page -- http://www.php.net/manual/en/language.operators.bitwise.php Edit -- https://master.php.net/note/edit/106123 Del: integrated -- https://master.php.net/note/delete/106123/integrated Del: useless -- https://master.php.net/note/delete/106123/useless Del: bad code -- https://master.php.net/note/delete/106123/bad+code Del: spam -- https://master.php.net/note/delete/106123/spam Del: non-english -- https://master.php.net/note/delete/106123/non-english Del: in docs -- https://master.php.net/note/delete/106123/in+docs Del: other reasons-- https://master.php.net/note/delete/106123 Reject -- https://master.php.net/note/reject/106123 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#183829) next »