title: Extract all ids from array of objects
body: <p>With PHP 7.4, I have associative array with objets :</p>
  <pre><code>$array = [
      1 =&gt; Class {
          'id' =&gt; 1,
          'call' =&gt; true,
      },
      5 =&gt; Class {
          'id' =&gt; 5,
          'call' =&gt; false,
      },
      7 =&gt; Class {
          'id' =&gt; 7,
          'call' =&gt; true,
      },
  ]
  </code></pre>
  <p>I want to extract all the IDs if the <code>call</code> attribute === <code>true</code>.</p>
  <p>After searching, I think I should use the <code>array_map</code> function.</p>
  <pre><code>$ids = array_map(function($e) {
      if (true === $e-&gt;call) {
          return $e-&gt;id;
      }
  }, $array);
  
  // Return :
  
  array(3) {
    [1]=&gt; 1
    [5]=&gt; NULL
    [7]=&gt; 7
  }
  </code></pre>
  <p><strong>But I have two problems with this:</strong></p>
  <ol>
  <li>I don't want <code>NULL</code> results</li>
  <li>I don't wish to have the associative keys in in my new <code>array</code>. I want a new array (<code>[0=&gt;1, 1=&gt;7]</code>)</li>
  </ol>
  <p>I know I can do it with a <code>foreach()</code> but I find it interesting to do it with a single PHP function (<code>array_walk</code> or <code>array_map</code> ?)</p>