1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

php text to characters function

Discussion in 'PHP' started by pein87, Aug 17, 2010.

  1. pein87

    pein87 New Member

    This function breaks a piece of text into characters and shows them on a newline. I could not for the love of me get the \n to work so I added <br /> instead.

    function textToCharacters($string)
    $sLen strlen($string); // length in numbers of the text
    $i 0// iteration start point
    $characters "";
    $i 0$i $sLen$i++) // iterate from 0 to length of the string

    $characters .= $string[$i]. "<br />"// store each character as a space seperated array.


    $characters// return the list of the characters



    Tested and works shows
    in the browser
    shabbir likes this.
  2. johnny.dacu

    johnny.dacu New Member

    Well... i don't think is a text to chars function. More like a text to text function because the output is after all another string. :)
  3. pein87

    pein87 New Member

    it break the original string into characters and shows them on a newline. Of course you dont need a function to get the text thats saved as a variable into characters you could of course just use $text[0].

Share This Page