Skip to content

Instantly share code, notes, and snippets.

@juareznjunior
Created March 24, 2011 20:58
Show Gist options
  • Save juareznjunior/885868 to your computer and use it in GitHub Desktop.
Save juareznjunior/885868 to your computer and use it in GitHub Desktop.
<?php
$select = array(
'qtd_movimentos'=>'count( distinct(m.identificacao) )::numeric as qtd_movimentos'
,'valor_movimentos'=>'sum(m.valor) as valor_movimentos'
,'qtd_autorizada'=>'sum (m.qtd_autorizada) as qtd_autorizada'
);
$fields = array('qtd_autorizada');
array_filter(array_keys($select),function($var) use ($fields,&$select) {
if (!in_array($var,$fields)) {
unset($select[$var]);
}
});
print_r($select);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment