PHP convert array list value to field aliase
<p>I would like to convert array list in to field alias. example:</p>

<pre><code>$keymap = ['id' =&gt; projectId, 'name' =&gt; projName];
</code></pre>

<p>Then from that array given, i want to do this convert:</p>

<pre><code>$keymap = ['id as projectId', 'name as projName'];
</code></pre>

<p>My goal is I have a json format response from api then I want to change the name of the key of each response based on the $keymap.</p>

<p>Any idea how? Thanks in advance</p>