#53. PHP Array_Rand & Shuffle Function

 How to work Array_Rand & Shuffle Function :





Run Code:

<?php

$cars = ["MG","Civic","Alto","Mehran","Carola"];
//$a = array("a" => 1.2,"b" => 32.2,"c" => 1.34 );    // Associative func

//$newArr = array_rand($a , 2);


shuffle($cars); // means that movement

echo "<pre>";
print_r($cars);
echo "</pre>";

// echo $a[$newArr[0]] . "<br>";
// echo $a[$newArr[1]];    // with Values show

Comments

Popular posts from this blog

#30. PHP Recursive Function