(PHP 4 >= 4.0.2, PHP 5, PHP 7)
wordwrap — ����ַ���Ϊָ���������ִ�
$str
[, int $width = 75
[, string $break = "\n"
[, bool $cut = FALSE
]]] ) : stringʹ���ַ����ϵ㽫�ַ������Ϊָ���������ִ���
str�����ַ�����
width�п�ȡ�
break
ʹ�ÿ�ѡ�� break ��������ַ�����
cut
��� cut ����Ϊ TRUE���ַ���������ָ���� width ����֮ǰλ�ñ���ϡ���ˣ�����еĵ��ʿ�ȳ����˸����Ŀ�ȣ��������ָ����������μ��ڶ�����������
������ FALSE ����������ָ�ʣ����� width С�ڵ��ʿ�ȡ�
���ش�Ϻ���ַ�����
Example #1 wordwrap() ����
<?php
$text = "The quick brown fox jumped over the lazy dog.";
$newtext = wordwrap($text, 20, "<br />\n");
echo $newtext;
?>
�������̻������
The quick brown fox<br /> jumped over the lazy<br /> dog.
Example #2 wordwrap() ����
<?php
$text = "A very long woooooooooooord.";
$newtext = wordwrap($text, 8, "\n", true);
echo "$newtext\n";
?>
�������̻������
A very long wooooooo ooooord.
Example #3 wordwrap() ����
<?php
$text = "A very long woooooooooooooooooord. and something";
$newtext = wordwrap($text, 8, "\n", false);
echo "$newtext\n";
?>
�������̻������
A very long woooooooooooooooooord. and something