File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes PHP and the fly likes How to assign random string value to variable in PHP5 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Languages » PHP
Reply Bookmark "How to assign random string value to variable in PHP5" Watch "How to assign random string value to variable in PHP5" New topic
Author

How to assign random string value to variable in PHP5

Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 235

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


Regards, Ricky
Oracle Weblogic 10g Certified Expert
TechBlog
Unnar Björnsson
Ranch Hand

Joined: Apr 30, 2005
Posts: 164
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:
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to assign random string value to variable in PHP5
 
Similar Threads
LIKE operator
Arraylist Issue
math function
storing bullets in a variable
Javascript and PHP