How to register variables of this array?

1

I'm developing a system that uses a web-service to retrieve the data needed for its power in the real estate segment. I'm learning PHP and I have a lot of problems learning arrays. Could you show me how I could retrieve specific data from this array: link ...

My print_r is returning all queried records, I would like to be able to save CATEGORIA co_de BAIRRO into 3 different variables so that I can use them later. I imagine in this case we have a two-dimensional array, is that it?

Evolution:

echo '<pre>'; print_r($res[523]['Data cadastro']); echo '</pre>';

With this code I can return a specific data from a specific record. But what if I wanted to return a specific data of all the elements? I tried the first empty index thinking that this would return me to the Data record of all the records without success:

echo '<pre>'; print_r($res[]['Data cadastro']); echo '</pre>';

This is the complete code for my script:

<?php

$array = array(
        'key' => '',
        'module' =>'imoveis',
        'method' => 'busca_imoveis',
        'field' => array(
            'DATA'          => 'Data cadastro',
            'CODIGO'        => 'Codigo',
            'CATEGORIA'     => 'Categoria',
            'UF'            => 'UF',
            'CIDADE'        => 'Cidade',
            'BAIRRO'        => 'Bairro',
            'ENDERECO'      => 'Endereco',
            'NUMERO'        => 'Numero',
            'VLR_VENDA'     => 'Valor',
            'DORMITORIO'    => 'Dormitorios',
            'URL_FOTO'      => 'Url',
            'IMAGEM_G'      => 'Foto'
     ),
        'filter' => array(
            'CONDICAO' => 'VLR_VENDA > 0'
    )
);

$client = new SoapClient(null, array(
        'uri'       => 'http://soap.imo.bi/',
        'location'  => 'http://soap.imo.bi/soap.dll',
        'trace'     => 'trace'
));

$array['order'] = array('VLR_VENDA' => 'DESC');
//$array['limit'] = '0, 10';
$res = $client->get($array);

echo '<pre>';
    print_r($res);
echo '</pre>';

?>
    
asked by anonymous 05.09.2014 / 17:12

1 answer

3

To get an item from a multidimensional array, just use more than one index.

Examples:

$teste1 = $array[0]['subitem']; 
$teste2 = $array['item']['subitem'];

Note that case is case sensitive = > value.

  

EDIT: As the question update:

 for ($i = 0; $i < count( $res ); ++$i ) {
    print $res[$i]['Data cadastro'];
 }
    
05.09.2014 / 17:51