note 106266 modified in function.str-repeat by tularis
| From: | tularis@php.net | Date: | Sun, 23 Oct 2011 12:49:44 +0000 |
| Subject: | note 106266 modified in function.str-repeat by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184081@lists.php.net to get a copy of this message | ||
hi guys ,
i've faced this example :
<?php
$my_head = str_repeat("°~", 35);
echo $my_head;
?>
so , the length should be 35x2 = 70 !!!
if we echo it :
<?php
$my_head = str_repeat("°~", 35);
echo strlen($my_head); // 105
echo mb_strlen($my_head, 'UTF-8'); // 70
?>
be carefull with characters and try to use mb_* package to make sure everything goes well ...
--was--
hi guys ,
i've faced this example :
<?php
$my_head = str_repeat("°~", 35);
echo $my_head;
?>
so , the length should be 35x2 = 70 !!!
if we echo it :
<?php
$my_head = str_repeat("°~", 35);
echo strlen($my_head); // 105
echo mb_strlen($my_head); // 70
?>
be carefull with characters and try to use mb_* package to make sure everything goes well ...
http://php.net/manual/en/function.str-repeat.php