Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
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, 5798👍, 0💬
Popular Posts:
What is hashing? To hash means to grind up, and that's essentially what hashing is all about. The he...
How To Blend a Color Layer to a Image? - PSP Tutorials - Fading Images to Background Colors with PSP...
How To Set Up Breakpoints in Debug Mode? - Oracle DBA FAQ - Introduction to Oracle SQL Developer To ...
Why does malloc(0) return valid memory address? What's the use? malloc(0) does not return a non-NULL...
Which one of the following statements is TRUE in regard to overloading the ++ operator? 1 You cannot...