Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2008
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    wordwrap() help please

    So I wrote this to make my strings "format" themselves:
    Code:
    $text = "This is a test string that's being formatted!";
    $newtext = wordwrap($text, 20, "<br />");
    echo $newtext;
    The problem I'm facing is that it correctly formats strings like this:

    This is a test string that's being formatted!
    But it completely ignores strings like this:
    ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF ASDFASDFASDFASDFASDFASDFASDF
    What can be done about this? Thanks
    -P

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Set wordwrap's fourth argument to true, this will force a cut in the middle of a string.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •