/ Published in: PHP
for heredoc syntax (like perl)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $str = <<<EOD Exemple de chaîne s'étalant sur plusieurs lignes avec la syntaxe heredoc EOD; /* Exemple plus complexe, avec des variables. */ class foo { var $foo; var $bar; function foo() { $this->foo = 'Foo'; } } $foo = new foo(); $name = 'MonNom'; echo <<<EOT Mon nom est "$name". J'affiche des $foo->foo. Maintenant, j'affiche un {$foo->bar[1]}. Ceci se traduit par un 'A' majuscule : \x41 EOT; ?>
URL: http://fr2.php.net/manual/fr/language.types.string.php#language.types.string.syntax.heredoc