separate with commas

前端 未结 7 1911
南方客
南方客 2021-01-29 13:45

hey there I have this,

$following_user_id .= $row[\'following_user_id\'];

and I get

44443344330

then I use th

相关标签:
7条回答
  • 2021-01-29 14:45

    Implode should not be inserting a comma at the end of that string there. Are you sure there isn't an empty string at the end of your array sequence?

    Either way, to fix the string you have, just get rid of the last character of the string:

    $concatUserIds = "44,44,33,44,33,0,";
    $concatUserIds = substr($concatUserIds, 0, strlen($concatUserIds) - 1);
    

    Further, if you're not going to be using the non-comma delimited number set, why don't you just add a comma every time you add a user id. That way you don't even have to use the implode function.

    0 讨论(0)
提交回复
热议问题