   [web] PHP & Carridge Returns
  HeyaIm discovering the joys of PHP and MySQL, and thought as a little project I'd create my own blogging software.Ive got a little page which writes the text to a database, and my website retrieves it without any difficulty.The problem is however is that as the text being entered is just straight from the html text box, all of the text is technically just on one line, so any carridge returns that I have entered with inputting the text now have no function.How would I go about replacing these carridge returns with the < br> tag?   
  Find out how they were added while you inputed...they could have been by "\n" (newline) or by "\r\n" (carrige return new line)...Then search for whatever it is and replace it with <br/>ArchG   ;  Sorry I should have been more specific, when I said I had entered carridge returns, I meant I have hit the return key :)   ;  Sorry I should have been more specific, when I said I had entered carridge returns, I meant I have hit the return key :)   ;nl2br()The documentation is your friend.John B   ;  ah ha!That works perfectly, thank you :)Rating points coming your way.   ;  ah ha!That works perfectly, thank you :)Rating points coming your way.   ;  The most important thing to know about PHP is if there is something you want to do, they probably already have a function to do it.The proof!Quote:Number of PHP  main functions: 3079 [1]Number of Perl main functions:  206 [2]Median PHP  function name length: 13Mean   PHP  function name length: 13.67Median Perl function name length:  6Mean   Perl function name length:  6.22Quote:* Escaping:    * PHP: (14)    dbx_escape_string, escapeshellarg, escapeshellcmd, pg_escape_bytea,    pg_escape_string, pg_unescape_bytea, addslashes, addcslashes, preg_quote,    quotemeta, mysql_escape_string, mysql_real_escape_string,    mysqli_real_escape_string, sqlite_escape_string    * Perl: (2) [1]    quotemeta, $dbh->quote* Sorting:    * PHP: (16)    sort, arsort, asort, krsort, ksort, natsort, natcasesort, rsort, usort,    array_multisort, uasort, uksort, dbx_sort, imap_sort, ldap_sort, yaz_sort    * Perl: (1)    sort* Walking a list    * PHP: (10)    array_filter, preg_grep, array_search, array_unique, in_array, array_map,    array_walk, array_count_values, array_change_key_case, array_sum    * Perl: (2)    map, grep* Splitting:    * PHP: (8)    split, explode, strtok, spliti, chunk_split, mb_split, preg_split,    str_split    * Perl: (1)    split* Matching:    * Strings:   * PHP: (11)   strstr, strchr, stristr, strpos, strrchr, stripos, mb_strpos,   mb_strrpos, strrpos, strripos, substr   * Perl: (3)   index, rindex, substr    * Regular expressions:   * PHP: (6)   ereg, eregi, mb_ereg, mb_eregi, preg_match, preg_match_all   * Perl: (1)   m//* Substituting a matched part:    * PHP: (12)    ereg_replace, eregi_replace, mb_ereg_replace, mb_eregi_replace,    preg_replace, str_ireplace, str_replace, ltrim, rtrim, trim, nl2br    * Perl: (1)    s///* Connecting to an SQL database:    * PHP: (17)    dbx_connect, fbsql_connect, ibase_connect, msql_connect, msql_pconnect,    mssql_connect, mysql_connect, odbc_connect, pg_connect, pg_pconnect,    sesam_connect, ifx_pconnect, ifx_connect, sqlite_open, sqlite_popen,    mysqli_connect, mysqli_pconnect    * Perl: (2)    DBI->connect, DBI->connect_cached* Opening:    * PHP: (5)    dio_open, fopen, proc_open, popen, gzopen[2]    * Perl: (2)    open, sysopen* Reading/receiving:    * PHP: (12)    dio_read, fread, gzread[2], socket_read, socket_recv, socket_recvfrom,    socket_recvmsg, readline, fgetc, fgets, stream_get_line, file    * Perl: (5)    read, readline, sysread, recv, getc* Printing/writing:    * PHP: (14)    print, echo, printf, fprintf, vprintf, dio_write, fwrite, fputs,    gzwrite[2], socket_send, socket_sendmsg, socket_sendto, socket_write,    socket_writev    * Perl: (5)    print, printf, syswrite, send, write* Closing:    * PHP: (7)    closelog, dio_close, fclose, gzclose[2], pclose, socket_close,    proc_close    * Perl: (1)    close* Miscellaneous:    * PHP:    array_combine, array_fill, array_merge, list, range, count,    create_function, strtr, pow, putenv, getenv, getmygid, getmypid, getmyuid    * Perl:    syntax or magic variablesNot saying it isn't a great language to work with. Their documentation is excellent on php.net, especially their function index and search. The community comments attached to functions often get around common problems faced when using them. I just with that they would have formed some sort of standard for naming functions or better yet, included namespace support and they could get the bulk of that crap out of the core language.   