Random Array element in PHP
<?php
// Numeric/ index arrays
$cars = array('Mecedes Benz', 'Hilux', 'Highlander', 'Hummer', 'Limozien');
$randomString = null;
for ($i = 0; $i < count($cars); $i++) {
$index = rand(0, count($cars) - 1);
$randomString .= $cars[$index];
print $cars[$index];
}
print $randomString;
?>
Comments
Post a Comment