<?php
$i=0;
$arN[$i]="Adiarray";
$arB[$i]="Matlab, Pyton, Bahasa R, Android, C++, Statistik";$i++;
$arN[$i]="Nico";
$arB[$i]="PHP Mysql, Desain Grafis, Layout, Photoshop, AuVi Apps";$i++;
$arN[$i]="Heru KZW";
$arB[$i]="Android Studio, Web Desain, CMS, CSS";$i++;
$arN[$i]="Tony Blair";
$arB[$i]="Java, Android, PHP Mysql, Matlab, C#, VBNET";$i++;
$arN[$i]="Rini DA";
$arB[$i]="Adobe Flash, Ms Office, Excell, Animation ";$i++;
$arN[$i]="JLaksamana";
$arB[$i]="Management Project, Pajak, Brevet, Accounting ";$i++;
$arN[$i]="Boy Chandra";
$arB[$i]="Unity 3D, Blender, VR, AR, Gamer Apps";$i++;
$arN[$i]="Poedji";
$arB[$i]="PHP Native, Laravel, Codeigneter, YII2, Database";$i++;
$arN[$i]="Sandri M";
$arB[$i]="Codeigneter, Android, PHP Mysql, Desainer, SEO";$i++;
$max = $i-1;
$done = false;
while(!$done){
$numbers = range(0, $max);
shuffle($numbers);
$done = true;
foreach($numbers as $key => $val){
if($key == $val){
$done = false;
break;
}
}
}
//var_dump($numbers);
?>
<div class="staff-bottom text-center">
<div class="col-md-3 staff-left">
<img src="img/foto_pengajar.jpg" alt="" />
<h4><?php echo $arN[$numbers[0]];?></h4>
<p><?php echo $arB[$numbers[0]];?></p>
</div>
<div class="col-md-3 staff-left">
<img src="img/foto_pengajar.jpg" alt="" />
<h4><?php echo $arN[$numbers[1]];?></h4>
<p><?php echo $arB[$numbers[1]];?></p>
</div>
<div class="col-md-3 staff-left">
<img src="img/foto_pengajar.jpg" alt="" />
<h4><?php echo $arN[$numbers[2]];?></h4>
<p><?php echo $arB[$numbers[2]];?></p>
</div>
<div class="col-md-3 staff-left">
<img src="img/foto_pengajar.jpg" alt="" />
<h4><?php echo $arN[$numbers[3]];?></h4>
<p><?php echo $arB[$numbers[3]];?></p>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
ATAU
$arr = range(0, 30);
shuffle($arr );
$arr = array_slice($arr ,0,6);
var_dump($arr);
hasilnya:
array(6) { [0]=> int(4) [1]=> int(28) [2]=> int(9) [3]=> int(22) [4]=> int(12) [5]=> int(6) }
Tidak ada komentar:
Posting Komentar