title: Replace non-specified array values with 0
body: <p>I want to replace all array values with 0 except <code>work</code> and <code>home</code>.</p>
  <p>Input:</p>
  <pre><code>$array = ['work', 'homework', 'home', 'sky', 'door']
  </code></pre>
  <p>My coding attempt:</p>
  <pre><code>$a = str_replace(&quot;work&quot;, &quot;0&quot;, $array);
  </code></pre>
  <p>Expected output:</p>
  <pre><code>['work', 0, 'home', 0, 0]
  </code></pre>
  <p>Also my input data is coming from a user submission and the amount of array elements may be very large.</p>