Advertisement
touhid_xml

Random string PHP

Jun 26th, 2014
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.30 KB | None | 0 0
  1. <?php
  2.  
  3. //String's array
  4. $strings = array('String1','String2','String3');
  5.  
  6. //Random key
  7. $key = array_rand($strings);
  8.  
  9. //display random string
  10. echo $strings[$key]; //when key = 0 result will be 'String1', when key = 1 result will be 'String2', when key = 2 result will be 'String3',
  11.  
  12. // by Touhid
  13. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement