How to get substring with multibyte string function and add characters to end of the substring in PHP

1 Answer

0 votes
$s = "programming php";

echo mb_strimwidth($s, 0, 6, "...") . "\n";
echo mb_strimwidth($s, 0, 6, "....") . "\n";
echo mb_strimwidth($s, 0, 6, ".....");





/*
run:

pro...
pr....
p.....

*/

 



answered Jun 23, 2021 by avibootz
...