title: PHP: Find the missing digit x from the given expression
body: <p>Have the function <strong>MissingDigit (str)</strong> take the <strong>str</strong> parameter, which will be a simple mathematical formula with three numbers, a single operator (+, -, *, or /) and an equal sign (=) and return the digit that completes the equation. In one of the numbers in the equation, there will be an x character, and your program should determine what digit is missing. For example, if <strong>str</strong> is <strong>&quot;3x + 12 = 46&quot;</strong> then your program should output 4. The <strong>x</strong> character can appear in any of the three numbers and all three numbers will be greater than or equal to 0 and less than or equal to 1000000.</p>
  <pre><code>
  function MissingDigit($str) {
  
     // code goes here
     return $str;
  }
  // keep this function call here
  echo MissingDigit (&quot;3x + 12 = 46&quot;);
  
  ?&gt;```
  </code></pre>