안녕하세요 질문좀드립니다
<?php echo $list[$i]['comment_cnt']; ?>
댓글수가 없으면 아무것도 안뜨는데요
만약 아무것도 없을때는 숫자 0 이라도 나게 할순 없나요 ㅠ?
|
답변 3개 / 댓글 1개
채택된 답변
+20 포인트
2016-12-05 (월) 16:45:37
$list[$i]['comment_cnt'] ? $list[$i]['comment_cnt'] : 0
2016-12-05 (월) 19:29:37
폰이라 오타 있었네요
number_format
입니다
number_format
입니다
2016-12-05 (월) 16:22:59
<?php echo numberformat($list[$i]['comment_cnt']); ?>
또는
<?php echo ($list[$i]['comment_cnt'] > 0?$list[$i]['comment_cnt']:'0'); ?>
또는
<?php echo ($list[$i]['comment_cnt'] > 0?$list[$i]['comment_cnt']:'0'); ?>
답변에 대한 댓글 1개
fldkfem1
2016-12-05 (월) 16:26:35
답변을 작성하려면 로그인이 필요합니다.
두번쨰꺼는 0만 나옵니다