- array_rand: documentation ( source)
<?php
$status = ['<span style="color: #B49012">pending</span>','<span style="color: #0D852F">success</span>','<span style="color: #D60401">cancelled</span>','<span style="color: #ef7502">error</span>'];
$test = $status[array_rand($status)];