开发者

PHP operators for comparing table rows with letters inside?

I have a simple CMS that I have set up.

In the database it has a row for short-story content and a row for full-story content on the same table.

I 开发者_开发技巧am trying to write an if else statement that basically shows the full story content if it has more characters or words inside.. or to show the short-story if the full-story == "NOTHING" :

if $full-story == 0 { echo 'short-story-content' }
else { echo 'full-story-content' }


if (strlen($row['full_story']) > strlen($row['short_story']))
{
    echo $row['full_story'];
}
else
{
    echo $row['short_story'];
}


function displayStory($full, $short) {
    $story = $short;

    if(strlen($full) > strlen($short) {
        $story = $full;
    }
    return $story;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜