Page 1 sur 1
Bug WAMP : T_CONSTANT_ENCAPSED_STRING
Posté : 30 nov. 2022, 19:32
par two3d
<?php
$text = "Ceci est un test";
Résultat :
Parse error: syntax error, unexpected '"Ceci est un test"' (T_CONSTANT_ENCAPSED_STRING) in C:\wamp64\www\test.php on line 2
J'ai rafraichi WAMP : rien
J'ai testé d'autres version PHP : rien

Re: Bug WAMP : T_CONSTANT_ENCAPSED_STRING
Posté : 30 nov. 2022, 20:09
par two3d
Il semblerait que c'est parce que je copie les fonctions sur le site php.net, si j'écris la fonction, ça fonctionne...
Re: [RESOLU] Bug WAMP : T_CONSTANT_ENCAPSED_STRING
Posté : 30 nov. 2022, 20:15
par or 1
il doit y avoir des caractères non visibles qui posent problème.
Re: [RESOLU] Bug WAMP : T_CONSTANT_ENCAPSED_STRING
Posté : 30 nov. 2022, 21:06
par two3d
Oui je penses aussi

Merci
Re: [RESOLU] Bug WAMP : T_CONSTANT_ENCAPSED_STRING
Posté : 02 déc. 2022, 16:24
par @rthur
Les deux espaces avant et après ton = sont des espaces insécables (caractère 0xa0 ) et non pas des espaces standards.
Tu peux le voir en utilisant cet outil qui va t'afficher en rouge les caractères spéciaux :
https://onlinephp.io/
Et surtout il faut que tu utilises un éditeur de code correct type Sublime Text qui te l'aurait affiché immédiatement.
Re: [RESOLU] Bug WAMP : T_CONSTANT_ENCAPSED_STRING
Posté : 02 déc. 2022, 22:28
par two3d
Bien vu, j'utilise Notepad++, ya moyen de voir les espace insécables sur cet éditeur ?
Re: [RESOLU] Bug WAMP : T_CONSTANT_ENCAPSED_STRING
Posté : 03 déc. 2022, 12:33
par @rthur
Bien vu, j'utilise Notepad++, ya moyen de voir les espace insécables sur cet éditeur ?
https://www.w3schools.io/editor/notepad ... den-chars/
La prochaine fois je te laisse faire la recherche Google

Re: [RESOLU] Bug WAMP : T_CONSTANT_ENCAPSED_STRING
Posté : 03 déc. 2022, 13:30
par two3d
Je te remercie, c'était au cas où tu savais tu aurais répondu rapidement et m'évitais de chercher
[EDIT] il me les affiche pas... c'est pas grave, si jamais j'ai ce problème à nouveau, je sais que c'est une possibilité
