• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to assign random string value to variable in PHP5

 
Ramakanta Sahoo
Ranch Hand
Posts: 256
Fedora Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have something like below. want to use any of the random values each time any query happens.


when I tried to run it gave me a error like below
Parse error: syntax error, unexpected '('

I just want to rotate the usernames when ever I query for $user , can you please let me know how to achieve this.


I'm very new to PHP so please bear with my silly syntax questions
 
Unnar Björnsson
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand you correctly you want to retrieve a random value from $abc each time an instance of the class is created, in that case you would use rand(minvalue, maxvalue) i.e:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic