I've wanted to check if a number in PHP was proper binary. So far I've added this to check if it is devisable by 8:
if(strlen($binary) % 8 == 0){
return true;
} else {
return false;
}
It works, but it obviously allows other numbers to be placed in, such as 22229999.
What method can I use to make sure only 1's and 0's are in the string? such as 10001001. Not sure how to go about this.