You are not logged in.
Vous en avez marre de ces putain d'apostrophes et autres double-quote qui pourrissent toutes vos chaînes de caractères. Les anti-slash, vous n'en pouvez plus ? La concaténation de variables rend votre code dépravé ?
La solution est simple : la méthode EOF (End Of File).
En fait, à vrai dire, cette méthode ne s'appelle pas la méthode EOF et n'a pas de nom précis. La méthode consiste à ouvrir une variable et pouvoir y mettre tout le texte désiré, espacé comme il se doit (utile pour du HTML en variable).
Son utilisation ? Très simple.
Commençons :
<?php $mavariable = <<<EOF Mon texte bien espacé et qui finit par très bien se placer. Oh mon dieu quand je repense aux longues heures où je devais recourir à ces antislash ! Maintenant, me voilà liiibre ''''''''''' """"""""""""""" '''''''''''' """""""""" Mouhahahahhahahah EOF; ?>
Du début à la fin de la zone EOF, notre texte est stocké dans la variable. La tradition veut que nous utilisions EOF au début et à la fin de notre grande chaîne de caractères mais vous pourrez remplacer ces trois lettres par celles de votre choix, tant que ce sont les mêmes en début et à la fin.
<?php $mavariable = <<<ANTISLASHSDEMERDE Mon texte bien espacé et qui finit par très bien se placer. Oh mon dieu quand je repense aux longues heures où je devais recourir à ces antislash ! Maintenant, me voilà liiibre ''''''''''' """"""""""""""" '''''''''''' """""""""" Mouhahahahhahahah ANTISLASHSDEMERDE; ?>
Eh bah voilà, c'était pas la peine de s'énerver ![]()
Merci à tous et à toutes ![]()
-------------------------------------------------------------------------
You don't want to use any trick to bypass your quotation and double-quotation marks ? You don't care about the backslashes ? The variables concatenation, you don't want to use that ?
Today, you got a solution : the EOF (End Of File) method.
In reality, this method doesn't got a name. With taht method, you can store text into variables without the problems of the slashes and the quotation marks.
How to use ? Very easy.
Let's begin :
<?php $myvariable = <<<EOF My very-well-spaced text can be stocked esaily. Oh my god, when I think about these long hours using backslashes ! Now, all that's finish. I'm freeeeee ! ''''''''''' """"""""""""""" '''''''''''' """""""""" Mouhahahahhahahah EOF; ?>
Beetwin the begin and the end of the text, we got EOF marks. The tradition is to use EOF at the begin and at the end of your text but you can replace these three letters by your choice, but you need to use the same at the beginning and the end of the text.
<?php $myvariable = <<<FUCKYOUBACKSLASHES My very-well-spaced text can be stocked esaily. Oh my god, when I think about these long hours using backslashes ! Now, all that's finish. I'm freeeeee ! ''''''''''' """"""""""""""" '''''''''''' """""""""" Mouhahahahhahahah FUCKYOUBACKSLASHES; ?>
All is done. Well, you didn't need to be so angry !
Thanks for reading this tutorial.
Offline
Very nice tuto
Offline