title: Is there a built-in PHP function to only return certain array keys with their value?
body: <p>Given the following array:</p>
  
  
  
  <pre class="lang-php prettyprint-override"><code>$data = [
      'a' =&gt; 1,
      'b' =&gt; 2,
      'c' =&gt; 3
  ];
  </code></pre>
  
  <p>Is there a PHP function that, called this way:</p>
  
  <pre class="lang-php prettyprint-override"><code>x($data, ['a', 'c']);
  </code></pre>
  
  <p>Would return this result:</p>
  
  <pre class="lang-php prettyprint-override"><code>[
      'a' =&gt; 1,
      'c' =&gt; 3
  ]
  </code></pre>
  
  <p>Please note that <em>I know how to write the code to generate the expected result</em>, so <strong>please only answer if there is a native PHP function to do that</strong>, or alternatively to mention that there isn't, if you know this for a fact.</p>