Question: I have some markup like so:

```
<div class="list">

    <article> content... </article>
    <article> content... </article>
    <article> content... </article>
    <article> content... </article>
    <article> content... </article>

</div>

```

What I want to do is make the order of what these articles appears on the page random. What would be the best and easiest way to do this?

I thought about doing some sort of length count and storing it in an array and then spitting them back out again in a random order. e.g.

```
$numbers = range(1, 20);
shuffle($numbers);
foreach ($numbers as $number) {
    echo "$number ";
}

```

Can anyone offer ideas etc? Thanks

**NOTE: These are not coming from a database!**

Answer: 
When dealing with something slightly more complicated than echoing out chunks of HTML from a database, you want to look at the [`DOMDocument` class](http://il.php.net/manual/en/class.domdocument.php). It will assist you with manipulating the HTML (a.k.a. the DOM) in any way you'd like.
I would use the DOM class: <http://php.net/manual/en/book.dom.php> and a DFS to mix the first level of the tree.