Any simpler and more efficient way of writing this code? I've noticed I've got quite a few repeated lines in my code.

$start = mktime(0, 0, 0, 3, 1, 2014);
$rate = 1 / 30;
$amount = number_format(floor((time() - $start) * $rate));

$id = array(
    array("42706686", "rebel2america"),
    array("100004055720670", "marquez.candace"),
    array("100000756492404", "vince.goode.3"),
    array("100007763585373", "laura.allen.75491"),
);

// 70% chance of red an 30% of green
$status = array(
    array("red", "no"),
    array("red", "no"),
    array("red", "no"),
    array("red", "no"),
    array("red", "no"),
    array("red", "no"),
    array("red", "no"),
    array("green", "yes"),
    array("green", "yes"),
    array("green", "yes")
);

$online = range(7, 21);

// create and assign a 'seed' value that changes 
// every $duration and assign to mt_srand
$duration = 5;
$mins = date('i', strtotime('now'));
$seed = $mins - ($mins % $duration);
mt_srand($seed);

// use mt_rand to build an 'order by'
// array that will change every $duration
$orderBy = array_map(function() {
    return mt_rand();
}, range(1, count($id)));

// sort $ids against $orderBy
array_multisort($orderBy, $id);

$orderBy = array_map(function() {
    return mt_rand();
}, range(1, count($status)));
array_multisort($orderBy, $status);

$orderBy = array_map(function() {
    return mt_rand();
}, range(1, count($online)));
array_multisort($orderBy, $online);

for($i = 0; $i &lt; 10; $i++) {
    $results1 = array_pop($id);
    $results2 = array_pop($status);
    echo "                            &lt;td&gt;{$results1[0]}&lt;/td&gt;\n";
    echo "                            &lt;td&gt;{$results1[1]}&lt;/td&gt;\n";
    echo "                            &lt;td&gt;&lt;span class=\"{$results2[0]}\"&gt;{$results2[1]}&lt;/span&gt;&lt;/td&gt;\n";
}
This part is duplicated:


$orderBy = array_map(function() {
    return mt_rand();
}, range(1, count($id)));
array_multisort($orderBy, $id);



You apply the same logic to $id, $status, $online.

To eliminate duplication, you can move this common logic to a function with one parameter:

function reorder(&amp;$arr) {
    $orderBy = array_map(function() {
        return mt_rand();
    }, range(1, count($arr)));
    array_multisort($orderBy, $arr);
}
reorder($id);
reorder($status);
reorder($online);


Note that we pass the array by reference (&amp;$arr), because array_multisort does the same, and modifies the content of the array anyway.

UPDATE

As other answers and comments have pointed out, you could also eliminate the magic numbers and duplication when creating the $status array, for example like this:

$color1 = array("red", "no");
$color2 = array("green", "yes");
$num_color1 = 7;
$num_color2 = 3;
$status = array_fill(0, $num_color1, $color1)
          + array_fill($num_color1, $num_color2, $color2);