-1
以下php腳本打印幾個語句和變量!他們打印在同一行上!我想一個接一個地打印它們在不同的行中!我該怎麼做? 例如一日2個發言應打印爲:php單獨行打印語句
在PHP編程的樂趣
我學會了如何在PHP
發表評論,但目前它打印在PHP 編程的樂趣我學會了如何在PHP
?php
echo "Programming in PHP is fun";
//This is the 1st programming 4 tutorial
/*This tutorial helped me
to gain a good knowledge in php! */
print "I learnt how to comment in PHP";
echo "A variable name must start with a letter or an underscore '_' -- not a number";
echo "A variable name can only contain alpha-numeric characters, underscores (a-z, A-Z, 0-9, and _)";
echo "A variable name should not contain spaces. If a variable name is more than one word, it should beseparated with an underscore or with capitalization ";
$name= "My name is XXX";
$number=25;
$float_number=10.245;
$negative_number=-12;
echo($name);
echo($number);
echo($float_number);
echo($negative_number);
$age=24;
$feature =$age;
echo($feature);
$x=45;
$y=12;
echo($x+$y);
$myName="My name is 'Lasith'";
?>
使用html'br'標記 –
使用'PHP_EOL'。例如: - echo($ x + $ y).PHP_EOL;' –
對於html,它是'
'。對於文本,它是'\ n'或'\ r \ n',它只能用雙引號,或者像Anant所說的PHP_EOL,它不能在引號內工作。 – aynber