Kmspico Download | Official KMS Activator Website [New Version 2024] Uw betrouwbare online apotheek Drogisterij Unique in Nederland Vavada вход позволяет мгновенно попасть в мир азартных игр и бонусов! Получи доступ и начни выигрывать прямо сейчас.

Bitwise Calculator Create Using PHP With HTML and CSS

Here’s a simple Bitwise Calculator using PHP that allows users to perform bitwise operations (`AND`, `OR`, `XOR`, `NOT`, `SHIFT LEFT`, `SHIFT RIGHT`) on two numbers.

Steps to Create:

1. Create an HTML form to accept two numbers and an operation.
2. Use PHP to process the input and perform the selected bitwise operation.
3. Display the result.

PHP Bitwise Calculator (bitwise_calculator.php)

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PHP Bitwise Calculator</title>
<style>
body { font-family: Arial, sans-serif; margin: 40px; }
form { width: 300px; padding: 20px; border: 1px solid #ddd; border-radius: 5px; }
input, select, button { width: 100%; margin-bottom: 10px; padding: 8px; }
</style>
</head>
<body>
<h2>Bitwise Calculator</h2>

<form method="post">
<label>Enter First Number:</label>
<input type="number" name="num1" required> 
<label>Enter Second Number:</label>
<input type="number" name="num2" required>
<label>Select Bitwise Operation:</label>

<select name="operation" required>
<option value="AND">AND (&)</option>
<option value="OR">OR (|)</option>
<option value="XOR">XOR (^)</option>
<option value="NOT">NOT (~, Only First Number)</option>
<option value="LEFT_SHIFT">Left Shift (<<)</option>
<option value="RIGHT_SHIFT">Right Shift (>>)</option>
</select>

<button type="submit" name="calculate">Calculate</button>
</form>

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$num1 = intval($_POST["num1"]);
$num2 = intval($_POST["num2"]);
$operation = $_POST["operation"];
$result = "";
switch ($operation) {
case "AND":
$result = $num1 & $num2;
break;
case "OR":
$result = $num1 | $num2;
break;
case "XOR":
$result = $num1 ^ $num2;
break;
case "NOT":
$result = "~$num1 = " . (~$num1);
break;
case "LEFT_SHIFT":
$result = $num1 << $num2;
break;
case "RIGHT_SHIFT":
$result = $num1 >> $num2;
break;
default:
$result = "Invalid Operation";
break;
}
echo "<h3>Result: $result</h3>";
}
?>
</body>
</html>