Create a Basic Calculator in PHP

<form>
  <input type="text" name="num1" placeholder="Number 1">
  <br>
  <input type="text" name="num2" placeholder="Number 2">
  <br>
  <select name="operator">
    <option>None</option>
    <option>Add</option>
    <option>Subtract</option>
    <option>Multiply</option>
    <option>Divide</option>
  </select>
  <br><br>
  <button type="submit" name="submit" value="submit">Calculate</button>
</form>
<p>The answer is:</p>
<?php
if (isset($_GET['submit'])) {
    $result1 = $_GET['num1'];
    $result2 = $_GET['num2'];
    $operator = $_GET['operator'];
    switch ($operator) {
        case "None":
            echo "You need to select a method!";
            break;
        case "Add":
            echo $result1 + $result2;
            break;
        case "Subtract":
            echo $result1 - $result2;
            break;
        case "Multiply":
            echo $result1 * $result2;
            break;
        case "Divide":
            echo $result1 / $result2;
            break;
    }
}
?>

This code creates a simple calculator that allows the user to enter two numbers and choose an operator (add, subtract, multiply, or divide). The form submits the user’s input to the PHP script, which then performs the calculation and displays the result.

You can add more functionality, validation, error checking and make the calculator more useful.

Please note that this is just an example, and if you plan on using it in a real-world scenario, you should add more error checking and validation to make sure that the input is valid and secure.