dpq755012465
2017-06-09 08:41 阅读 44
已采纳

Rtrim不起作用

Help rtrim would not work whatever I do. I also tried to add whitespace after "," like it was on one of the topics i searched here

$this->items = array();
$xcount='(';
foreach ($items as $v) {
   $this->items[$v['id']] = $v;
   $xcount.=$v['id'].',';
};
rtrim($xcount, ",");

$xcount.=')';
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    doudou890510 doudou890510 2017-06-09 08:43

    The rtrim() returns a value and does not modify the original value. Please use it this way:

    $xcount = rtrim($xcount, ",");
    

    From the rtrim():

    This function returns a string with whitespace (or other characters) stripped from the end of str.

    点赞 评论 复制链接分享