我正在编写一个PHP脚本,该脚本将删除长度小于3个字符的所有单词。我在php中使用一行if语句,然后得到意外错误;但是没有;在我的代码里。如果有人能给我指明正确的方向,那就太棒了。
?><td><?php echo (checkWord($input))?$input:?><del><?php $input?></del></td><?php
checkWord函数接受字符串作为输入,如果字符串长度小于3个字符则返回false。否则返回true。
我相信这是一些简单的东西,我忘记放在行,所有的帮助是感激和感谢提前
试试这个:
<td><?php echo (checkWord($input)) ? $input : "<del>$input</del>"; ?></td>