Page 1 of 1

What does $a = ($b >> $c) mean ?

Posted: Fri Jan 19, 2007 5:32 pm
by Joost
Hello,

I came across a piece of PHP code that utilizes

Code: Select all

$a = ($b >> $c);
I have searched the tutorials and manual but couldn't find what the function is exactly.

Anyone that can help me out ?

Posted: Fri Jan 19, 2007 5:39 pm
by Garcia
Here this may help.

http://www.php.net/manual/en/language.o ... itwise.php

Edit: Haha Ninja Space Goat :P

Posted: Fri Jan 19, 2007 5:39 pm
by Luke
http://us2.php.net/language.operators.bitwise

EDIT: DARN... too slow on the draw! :x

Posted: Fri Jan 19, 2007 5:46 pm
by Kieran Huggins

Posted: Fri Jan 19, 2007 6:01 pm
by Joost
Ah, great help guys thanx!

Another one for you :roll:

What is the catch with feeding chr() integers past 255 ?

I mean, PHP takes chr(12034) without a complaint and returns an ASCII character. But how does it come up with the ASCII value for the character ?

Posted: Fri Jan 19, 2007 6:26 pm
by aaronhall
Try this out:

Code: Select all

echo '<table>';
for($i=0; $i<3; $i++) {
	echo '<tr>';
	echo '<td>chr('.($i*255).')-chr('.((($i+1)*255)-1).')';
	for($j=0; $j<=254; $j++) {
		echo '<td>', chr($j), '</td>';
	}
	echo '</tr>';
}
echo '</table>';
For every 255 characters, chr() will start over at ascii(0) and continue rotating through the characters (e.g., 255=0, 256=1, 257=2,...)

Posted: Fri Jan 19, 2007 6:32 pm
by Luke
wtf? that printed out
Ï ƒå®†€Ð
:twisted:

Posted: Fri Jan 19, 2007 6:36 pm
by aaronhall
This is what I'm getting with $i=10: http://www.evilwalrus.org/_public/testchr.php

edit: With $i<10, rather.