I'm learning PHP (I'm a very newbie :-) and I'm testing PHP code from my tutorial. Next code should write the text strings in several lines, but it only writes one line... Why??
- Code: Select all
<p>
<?php
echo "First line \n Second \n Third \n";
echo "another \n and other";
$texte2 ="1st line \n 2nd line";
echo "$texte2"
?>
or for example:
- Code: Select all
<?php
/* Asignando una cadena. */
$str = "Esto es una cadena";
/* Añadiendo a la cadena. */
$str = $str . " con algo más de texto";
/* Otra forma de añadir, incluye un carácter de nueva línea protegido. */
$str .= " Y un carácter de nueva línea al final.\n";
echo "$str";
echo "berberecho";
Thanks,
Joan


