Friday, May 24, 2013

Array Randomize PHP Tutorial

An array is a set of variables that have the same name but distinguished by the index.



Useful for example in an array of programming that requires a few variables that will hold the data with the same data type and will receive similar treatment. Now, rather than worry about the variable names are different, it is better to use a variable name but each is distinguished by the index.



Index can be either numbers or strings. If the index-shaped array of numbers, then the array will be called indexed arrays (vector), whereas if the index of a string, then the array will be called associative arrays.









[Array Randomizing]





"12","d" => "22","b" => "34","c" => "67");



print "Data before randomizing =

";

foreach ($angka as $tampil => $tampil1)

{

print "$tampil : $tampil1

";

}



print "Data after randomizing =

";

shuffle($angka);

foreach ($angka as $tampil => $tampil1)

{

print "$tampil : $tampil1

";

}

?>