Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
Other Resources:
How To Randomly Retrieve a Value from an Array
How To Randomly Retrieve a Value from an Array? - PHP Script Tips - PHP Built-in Functions for Arrays
✍: FYIcenter.com
If you have a list of favorite greeting messages, and want to randomly select one of them to be used in an email, you can use the array_rand() function. Here is a PHP example script:
<?php $array = array("Hello!", "Hi!", "Allo!", "Hallo!", "Coucou!"); $key = array_rand($array); print("Random greeting: ".$array[$key]."\n"); ?>
This script will print:
Random greeting: Coucou!
2007-04-21, 5237👍, 0💬
Popular Posts:
What Is the Data Pump Import Utility? - Oracle DBA FAQ - Loading and Exporting Data Oracle Data Pump...
How To Merge Cells in a Column? - XHTML 1.0 Tutorials - Understanding Tables and Table Cells If you ...
What will be printed as the result of the operation below: main() { int x=20,y=35; x=y++ + x++; y= +...
How To Merge Cells in a Row? - XHTML 1.0 Tutorials - Understanding Tables and Table Cells If you wan...
What is test metrics? Test metrics accomplish in analyzing the current level of maturity in testing ...