Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. <?php
  2. // unordered list
  3. $arr = array(1, 2, 3, 3.14, 5, 4, 6, 9, 8);
  4.  
  5. // searched value
  6. $x = 3.14;
  7. $index = count($arr);
  8.  
  9. while ($arr[$index--] != $x);
  10.  
  11. echo "The value $x found on position " . ($index+1) . "!";
  12. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement