How to get multi-byte string length in PHP

2 Answers

0 votes
$s = "לתכנות עדיין יצטרכו בני אדם בעתיד";

echo mb_strlen($s);

// use only function that start with: 'mb_' ('mb_' prefix)

/*
run:

61

*/

 



answered Aug 10, 2015 by avibootz
0 votes
$s = "לתכנות עדיין יצטרכו בני אדם בעתיד";

echo mb_strlen($s, 'UTF-8');

// use only function that start with: 'mb_' ('mb_' prefix)

/*
run:

33

*/

?>

 



answered Aug 10, 2015 by avibootz
...