Posts Tagged ‘lorem ipsum’

Simple PHP one-liner to generate random Lorem Ipsum (Lipsum) text.

August 16th, 2011 5 comments

Copying and pasting lipsum text from a site such as can be boring and tedious at times, especially when you would like to test multiple blocks and how well they will look with text of varying length.

Getting random lipsum of varying length is pretty easy in PHP, in fact you can do it on just one line of code:

$lipsum = simplexml_load_file(‘’)->lipsum;

Need more than one random string? Turn it into a method:

function random_lipsum($amount = 1, $what = ‘paras’, $start = 0) {

return simplexml_load_file(“$amount&what=$what&start=$start”)->lipsum;



  • $amount is… how much of $what you want.
  • $what is either paras, words, bytes or lists.
  • $start is whether or not to start the result with ‘Lorem ipsum dolor sit amet…
Categories: All, PHP, Web