Binary Numbers:Universally binary numbers in every language are made up of only 0s and 1s.In PHP Binary numbers are also represented by any variable name followed by ‘ $ ’ (Variable name can be anything like $number, $string etc).
$Binary = 1010101;
Declaring Variable in PHP:
To declare the variable of any type in PHP first write “$”, that is keyword of php. Then write variable name and then semicolon. We can give default value on declaration time. Following is the sample code.
$Variable = 1230;
This is simple code to declare a variable with default value in Php.
Declaration/Initialization of Binary numbers in Php:
To declare the variable of binary or decimal type in PHP first write “$”, that is keyword of php. Then write variable name and then semicolon. Following is the sample php code. We can give default value on declaration time. But default value can only be in form of 0s or 1s or combinations of both 0s and 1s in case of binary and in case on decimal it can be combination of digits from 0 to 9. Following is the sample code.
$Binary_Variable = 101010;
Echo “The value in Binary is : $Binary_variable”;
This is code to declare a binary variable with default value.
This simple article tells that how we can initialize/declare binary numbers in PHP.
Declare / Initialize Binary Number in PHP