Advertisement
Guest User

Untitled

a guest
May 23rd, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. <?php
  2. $article = "hello <a href='http://www.someotherwebsite.com'>testlink</a> everyone" ;
  3. $parts = explode(" ", $article);
  4. $randomamount = count($parts);
  5. $hit = rand(0, $randomamount);
  6. if(isset($_SESSION['last'])) {
  7. // already seen?ok
  8. if($hit == 0) {
  9. $hit=$hit+1;
  10. } else {
  11. $hit=$hit-1;
  12. }
  13. }
  14. $_SESSION['last']=$hit;
  15. echo $parts[$hit];
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement