Friday, February 6, 2009

PHP Functions, nl2br() and wordwrap(), MIT Books

php: function: nl2br()
php.net/nl2br
info: Returns string with '<br />' or '<br>' inserted before all newlines.
usage:
<?php
echo nl2br("foo isn't\n bar");
?>

output:
foo isn't<br />
bar

php: function: wordwrap()
http://php.net/manual/en/function.wordwrap.php
info: wordwrap — Wraps a string to a given number of characters
usage:
<?php
$text = "The quick brown fox jumped over the lazy dog.";
$newtext = wordwrap($text, 20, "<br />\n");

echo $newtext;
?>


output:
The quick brown fox<br />
jumped over the lazy<br />
dog.


http://movetonext.com/
http://zero2beta.com/?page_id=2

Middle East - Web 2.0 Consultancy company
http://www.spinbits.com/

books: MIT: How to design programs. An introduction to computer programming
http://www.htdp.org/2003-09-26/Book/

books: MIT: Structure and Interpretation of Computer Programs
http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-3.html
tag: wizard book, purple book, {color book}

1 comment:

maddy said...

Thanks! very helpful for me.