Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $armurerie= array("epee" => 50, "bouclier" => 35, "armure" => 85, "marteau" => 50, "dague" => 25, "shuriken" => 5);
- function tri($tab)
- {
- foreach ($tab as $key => $value)
- {
- $taille = count($tab);
- for($i = 1; $i < $taille; $i++)
- {
- for($j = $taille-2; $j >= $i; $j--)
- {
- if($tab[$j+1] < $tab[$j])
- {
- $temp = $tab[$j+1];
- $tab[$j+1] = $tab[$j];
- $tab[$j] = $temp;
- }
- }
- }
- }
- }
- tri($armurerie);
- var_dump($armurerie);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment