I am trying to do a binary addition and I cant seem to figure it out. The whole point is to display to binary numbers, enter your answer and see if it correct, but I have problem even figuring out how to just add two given binary numbers. Please some help would be very much appreciated. This is what I have but it is after the conversion, when added it does not do a binary addition, it just adds them as normal.
#!/usr/local/bin/php
<?php
$value1 = $POST['value1'];
$value2 = $POST['value2'];
$binary1 = base_convert($value1, 10, 2);
$binary2 = base_convert($value2, 10, 2)
?>
<html>
<title>Add two binary numebrs</title>
<body>
<form action="" method="post">
<input type="text" name="value1" value=" " />
<input type="text" name="value2" value=" " />
<input type="submit" value="Calculate values"/>
</form>
Answer :
<?php
$answer = $binary1 + $binary2;
echo $answer;
?>
</body>
</html>