title: PHP array delete by value (not key)
body: <p>I have a PHP array as follows:</p>
  
  <pre><code>$messages = [312, 401, 1599, 3, ...];
  </code></pre>
  
  <p>I want to delete the element containing the value <code>$del_val</code> (for example, <code>$del_val=401</code>), but I don't know its key. This might help: <strong>each value can only be there once</strong>.</p>
  
  <p>I'm looking for the simplest function to perform this task, please.</p>