และได้พบคำสั่ง mb_substr รูปแบบการใช้งานคือ
mb_substr(string $str ,int $start[, int $length[, string $encoding]])
การใช้งาน
Code
<?
$massage = 'หลายๆตัวว่าเข้ามีวิธีการยังไงในการตัดข้อความไม่ให้แสดงสี่เหลียมต่อท้าย';
mb_substr('$massag',0,15,'UTF-8');
?>
$massage = 'หลายๆตัวว่าเข้ามีวิธีการยังไงในการตัดข้อความไม่ให้แสดงสี่เหลียมต่อท้าย';
mb_substr('$massag',0,15,'UTF-8');
?>
mb_substr
(PHP 4 >= 4.0.6, PHP 5)
mb_substr — Get part of string
Description
string mb_substr ( string
$str , int $start [, int $length [, string $encoding ]] )Performs a multi-byte safe substr() operation based on number of characters. Position is counted from the beginning of
str. First character's position is 0. Second character position is 1, and so on.
Parameters
str- The string to extract the substring from.
start- Position of first character to use from
str. length- Maximum number of characters to use from
str. encoding- The
encodingparameter is the character encoding. If it is omitted, the internal character encoding value will be used.
See Also
- mb_strcut() - Get part of string
- mb_internal_encoding() - Set/Get internal character encoding
No comments:
Post a Comment