Re: wordwrap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 3, 2014 at 7:10 PM, Negin Nickparsa <nickparsa@xxxxxxxxx> wrote:

> I am learning string functions in php, I couldn't understand wordwrap
> although I read first examples.
>
> I have this example in the book:
> $text = "able osts indy";
> $newtext = wordwrap($text, 1, "c",false);
>
> echo $newtext;
>
> result is ablecostscindy
>
> I understand that by adding </br> or </n> we are breaking the string every
> with number so is the able the zerost word and the osts first word and so c
> is added there or what? I need to clarify this in my mind. thank you.
>
> Sincerely
> Negin Nickparsa
>

It all bottles to that fourth param (you have it set to false). If it is
set to false, it will keep words intact and wrap (based on the third
param). If set to true, it will cut the words. So in your example, if your
fourth param was true you would've had:

acbclcecocsctcscicncdcy

As you can see the wrapper is inserted every x positions (where x is the
second param).

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux