• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to split a string

#6
[eluser]megabyte[/eluser]
OK, from the beginning

-take row from db which is a page of text.
- this text was placed in their from a form textarea.
- I then use nl2br, then format text to paragraphs using a function I created below.
- I then want to split the html into 2 equal parts so that I can have 2 equal columns on a webpage like in a newspaper.

Code:
function nl2p($string)
{
    $string = nl2br($string);
    $array = explode('<br />', $string);
    
    $out = '';
    
    foreach($array as $val)
    {
        $out .= '<p>'.$val.'</p>';
        $out .= "\n";
    }
    return $out;
}


Messages In This Thread
how to split a string - by El Forum - 10-12-2009, 06:27 PM
how to split a string - by El Forum - 10-12-2009, 06:36 PM
how to split a string - by El Forum - 10-12-2009, 06:45 PM
how to split a string - by El Forum - 10-12-2009, 06:48 PM
how to split a string - by El Forum - 10-12-2009, 06:55 PM
how to split a string - by El Forum - 10-12-2009, 07:01 PM
how to split a string - by El Forum - 10-12-2009, 07:07 PM
how to split a string - by El Forum - 10-12-2009, 07:24 PM
how to split a string - by El Forum - 10-12-2009, 07:53 PM
how to split a string - by El Forum - 10-13-2009, 05:32 AM
how to split a string - by El Forum - 10-13-2009, 09:29 AM
how to split a string - by El Forum - 10-13-2009, 05:22 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.