How to randomise the order of paragraphs with PHP

One part of launching new websites which offer pretty much the same products and services is rewriting content so that it doesn’t appear to be a direct copy of exiting websites.

To help me rewrite articles, I find it helps me to randomise the order of key selling points so I can focus on rewriting them rather then thinking about how they should be ordered.

To randomise the order of paragraphs I wrote a PHP script using the shuffle function to randomise the appearance of selling points in an array

<?php
$sellingpoints = array(
'Double sided printing.',
'Same day print & dispatch',
'Delivery before 12pm (Express) & 10am (Express Plus).',
'Round corner finish.',
'UV coating (extra rich colours and more durable finish).',
'Various quantities ranging from 100 - 5,000.', );
shuffle($sellingpoints);
foreach ($sellingpoints as $sellingpoints){
echo('<p>'.$sellingpoints.'</p>');
}
?>

Leave a Comment

Your email address will not be published. Required fields are marked *