I would like to separate a string in PHP and take specific data

1

I'm doing a view grabbing data from a txt file but the function is returning the entire line and I want only the column. It would have a way to bring only the specific column.

public function carregarPA($arq,$linha){
    $arquivo = file($arq);
    $y = $linha - 1;
    return $arquivo[$y];
}

In return, the following is the return:

67 0 0 0 0 0 0 0 82 0 68 12 0 0 2 .00

I want only the number "82". I've tried the explode () but it did not work.

    
asked by anonymous 27.12.2017 / 11:52

1 answer

0

Use substr

Example

substr($arquivo[$y],17,2)
    
27.12.2017 / 11:55