An Error occurred when a function is called inside a Class.
The error message:
Parse error: syntax error, unexpected '$arquivo' (T_VARIABLE), expecting function (T_FUNCTION) or const (T_CONST) in C:\xampp\htdocs\sequencial\function_sintegra.php on line 20
Here I provide my code:
<?php
function explode_txt(){
$arquivo = $_SESSION['nomeArquivo'];
$conteudo = file_get_contents($arquivo);
$linhas = explode("
", $conteudo);
}
class Sintegra{
private $emissor;
private $cnpj;
private $inscricao;
private $municipio;
private $estado;
private $dataInicial;
private $dataFinal;
$arquivo = explode_txt(); //Arquivo Sintegra em array nesta variavel, por linhas.
$emissor = (string)substr($arquivo[0], 30, 35);
$inscricao = (string)substr($arquivo[0], 16, 14);
$cnpj = (string)substr($arquivo[0], 2, 14);
}
?>
Is there something wrong with how I access the function? I have tried to browse but could not find any solution. Thank you for your help.