4

In php how do I convert a string "1010101010" into the integer value represented by this binary number?

eg "10" would go to 2, "101" would go to 5

2 Answers 2

9

Use bindec() function to convert from binary to decimal:

$value = bindec("10101011010101");
Sign up to request clarification or add additional context in comments.

1 Comment

I knew there had to be a function for it somewhere
2

Try the bindec() function.

1 Comment

how to convert integer greater than limits

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.