如果echo语句中的值为2,则显示文本?

时间:2012-05-18 19:37:45

标签: php

我有以下echo语句,它显示会话中的数值:

<?php echo(str_replace('"', '&quot;', $row_WAATKgblqemplisting['Group'])); ?>

如果$row_WAATKgblqemplisting['Group']

,我如何更改此声明

等于2它说:这是#2 如果它等于1则说:这是#1 如果它等于3,它说:这是#3?

3 个答案:

答案 0 :(得分:2)

echo 'This is #' . $row_WAATKgblqemplisting['Group'];

如果要写入HTML,您可以使用实体&#35;代替ASCII #

答案 1 :(得分:0)

$number =  $row_WAATKgblqemplisting['Group'];
echo 'This is &#35;'.$number;

那是你想要做的吗?

答案 2 :(得分:0)

echo "This is #{$row_WAATKgblqemplisting['Group']}\n";
相关问题