EnexoOnoma
EnexoOnoma

Reputation: 8834

How to remove � at the end of a substr string?

how can I remove this char that is produced at the end of my substr string?

Upvotes: 1

Views: 779

Answers (3)

SIFE
SIFE

Reputation: 5715

This will remove last char from $mystr.

$newstr = substr($mystr, 0, -1);

Upvotes: 0

Randy
Randy

Reputation: 16673

is it always there? then maybe do an additional -1 from the length when you take the substring...

Upvotes: 0

Headshota
Headshota

Reputation: 21449

try using mb_substr instead of substr

mb_substr

Upvotes: 3

Related Questions