Jump to content

double left arrow


The Little Guy

Recommended Posts

Here's what happens, step by step, if you're still confused

 

<?php 

// OUtput in plain text
header("Content-type: text/plain");

// Format is using 0 to pad the left side, 16 length, and binary
$format = '%016b';

$c = 5;
$j = 7;
echo '$c*$j:      '.sprintf($format,($c*$j))."\n";

echo '($c*$j)<<2: '.sprintf($format,(($c*$j)<<2))."\n";

echo 'Same as $c*$j with bits moved 2 to the left';

?>

 

$c*$j:      0000000000100011
($c*$j)<<2: 0000000010001100
Same as $c*$j with bits moved 2 to the left

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.