matt0268 Posted October 4, 2013 Share Posted October 4, 2013 Doing some bitmasking, how do i store this in a variable/temp variable? $val = 128; $places = $_GET['action']; $res = $val >> $places; p($res, $val, '>>', $places); function p($res, $val, $places, $note = '') { $format = '%0' . (PHP_INT_SIZE * 1) . "b\n"; printf($format, $res); } Quote Link to comment Share on other sites More sharing options...
Barand Posted October 4, 2013 Share Posted October 4, 2013 Change your function to return the value instead of echo $val = 128; $places = $_GET['action']; $res = $val >> $places; $stored = p($res, $val, '>>', $places); function p($res, $val, $places, $note = '') { $format = '%0' . (PHP_INT_SIZE * 1) . "b\n"; return sprintf($format, $res); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.