I need to somehow check if there is any element within a given array
and if it exists, put a string
in a specific place. For example:
I need to check if
$categoria
is not empty
$categoria = array($values);
And after checking that it is not empty, insert the string below into
filter
$categoria = " 'Categoria' => array($values) ";
The array
is this and I have to insert these instructions inside the filter:
$dados = array (
'fields' => array(
'ImoCodigo',
'Categoria',
'Bairro',
'ValorVenda',
'Dormitorios',
'Vagas',
'FotoDestaque'
),
'filter' => array(
// As strings devem ser inseridas exatamente aqui separadas por vírgula
),
'paginacao' => array(
'pagina' => 1,
'quantidade' => 50
)
);
The end result would look like this:
...
'filter' => array(
'Categoria' => array($values),
'Cidade' => array($cidades),
'ValorVenda' => array($preco)
),
...