Parse error: syntax error, Unexpected ' ' (T_STRING)

Asked

Viewed 355 times

-2

    <?php
 // Array com os dias da semana
 $diasemana = array('Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sabado');

 // Aqui podemos usar a data atual ou qualquer outra data no formato Ano-mês-dia (2014-02-28)
 $data = date('Y-m-d');

 // Varivel que recebe o dia da semana (0 = Domingo, 1 = Segunda ...)
 $diasemana_numero = date('w', strtotime($data));

 // Exibe o dia da semana com o Array
 echo $diasemana[$diasemana_numero];
?>  

1 answer

2

You have (almost) invisible characters in your code (in space), at the beginning of each line. Remove the spaces that are at the beginning of each line. This was definitely caused by copying and pasting this code from somewhere...

  • 3

    Which, by the way, is the character &#8195;

  • Exactly, that same one :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.