Blogger Information
Blog 48
fans 3
comment 1
visits 36987
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
初识PHP【字符串的处理】——2018年4月11日
JackBlog
Original
488 people have browsed it

QQ截图20180412124130.jpg


实例

<?php
$name='JACK';
$age = '26';
$marry = 'Yes';

echo 'My Name:'.$name.' Age:'.$age.' Marry:'.$marry;
echo '<br>';
echo "My Name:$name Age:$age Marry:$marry";

echo '<hr color=red>';
echo "曾经有一份真诚的爱情放在我面前,我没有珍惜,等我失去的时候我才后悔莫及,人世间最痛苦的事莫过于此。\n如果上天能够给我一个再来一次的机会,我会对那个女孩子说三个字:\"我爱你\"。\n如果非要在这份爱上加上一个期限,我希望是……一万年!";
echo '<br><br>';
echo "我想对你说:'我爱你'!";
echo "我想对你说:\"我爱你\"!";
echo '<hr color=blue>';

$text = <<< "HEREDOC"
{$name}是一个很不错的人。\n他今年已经{$age}岁了。
HEREDOC;
echo $text;
echo '<br>';
echo nl2br($text);

echo '<hr>';

$text =<<< 'NOWDOC'
$name是一个不错的人,\n他是我的'男神'
NOWDOC;
echo $text;
echo "<br><span style='color:red'>NOWDOC不解析变量和特殊的字符</span>";

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!