LucSatise   -  Dec 25, 2012

did the forum die or somethin? I was hopin someone here could give me a php version of mirc's $isbit for a conversion i'm doing atm.

Hawkee  -  Dec 25, 2012

We've deprecated the forum. It is still available at the bottom of the site, but we are moving away from Q&A since StackOverflow has that covered so well.

LucSatise  -  Dec 25, 2012

Fair enough. havent got a clue on my problem have you?

Aion-  -  Dec 25, 2012

I am not familiar with PHP, but I believe you could use the decbin function to get a string representation of the given decimal number in binary. After this, you would simply need to check whether the Nth bit equals 1.

There are probably much better approaches, but this should do the job.

Edit: base_convert(string $number, int $frombase, int $tobase) may also be of interest.

Hawkee  -  Dec 25, 2012

What are you trying to accomplish? I'm not sure what $isbit does.

Aion-  -  Dec 25, 2012

According to mIRC's help docs,

$isbit(A,N)
Returns 1 if the Nth bit in number A is turned on.

Sorasyn  -  Dec 25, 2012

What kind of conversions are you looking at?

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.