PHP Arrays and Strings Interface [closed]

1

Situation

I have a page in PHP that does CNPJ searches and returns the values, but as it is not formatted, the results appear in ARRAY and STRINGS .

Example

    array(23) { [0]=> string(18) "XX.XXX.XXX/XXXX-XX" [1]=> string(10) 
    "XX/XX/XXXX" [2]=> string(58) "EMPRESA XXXXXXXX" [3]=> string(10) 
    "FANTASIA" [4]=> string(90) "DESCRIÇÃO" [5]=> array(2) { [0]=> 
    string(67) "4X.5X-2-0X - XXXXXXXXXX SERVIÇOS " [1]=> string(80) 
    "XX.11-X-00 - Atuação XXXXXXXX" } [6]=> string(68) "230-5 - 
    EMPRESA INDIVIDUAL DE RESP.LIMITADA (DE NATUREZA EMPRESARIA)" 
    [7]=> string(37) "R XXXXXXXXXX (JD XX)" [8]=> string(2) "55" 
    [9]=> string(0) "" [10]=> string(10) "09.XX0-XXX" [11]=> string(15) 
    "XXX BAIRRO" [12]=> string(21) "XXX XXXX XX XXX" [13]=> string(2) 
    "XX" [14]=> string(26) "[email protected]" [15]=> string(14) 
    "(1x) XXXX-XXXX" [16]=> string(5) "*****" [17]=> string(5) "ATIVA" 
    [18]=> string(10) "XX/03/XXXX" [19]=> string(0) "" [20]=> string(8)
     "********" [21]=> string(8) "********" ["status"]=> string(2) "OK" }

What exactly do you want?

I do not look for anything chewed, I just want a direction, where to start. More specifically I would like to know how I can specify for a certain space to call a certain string, for example: a text box inside it will have string 8.

Summary Summary

Allocate Array and String to a given location.

I hope you've figured it out , if I can get a better idea of how I can explain it, I'll edit the question.

    
asked by anonymous 05.04.2016 / 18:38

1 answer

3

I think you're confusing, that " string (n) " that appears only shows the size of the characters that are inside each index of the array.

If I understand correctly, I believe you are wanting to display a single index of the array separately. If this is the case with the following array distributed like this:

$array = array(
    [0] => "a",
    [1] => "b",
    [2] => "c",
    [3] => "d"
);

or so:

$array = array([0] => "a", [1] => "b", [2] => "c", [3] => "d");

Just call the index you want:

//o resultado seria "b"
echo $array[1];

I hope I have helped;

Att;

    
05.04.2016 / 19:13