Note: This post refers to code and a project from many years ago 😱. The content was edited in March of 2025 to remove dead links, improve clarity, or fix formatting, but no other edits were made. Enjoy this time capsule into the past.
I was searching for a php list of greetings but couldn’t find one so I made my own. Thought this may be helpful to someone else looking for a list. Here is how to show a random greeting in php. Much like the flickr welcome page.
//random array function you can use or write your own
function randomArrayVar($array)
{
if (!is_array($array)){
return $array;
}
return $array[array_rand($array)];
}
//list of grettings as arary
$greeting= array(
"aloha"=>"Aloha",
"ahoy"=>"Ahoy",
"bonjour"=>"Bonjour",
"gday"=>"G'day",
"hello"=>"Hello",
"hey"=>"Hey",
"hi"=>"Hi",
"hola"=>"Hola",
"howdy"=>"Howdy",
"rawr"=>"Rawr",
"salutations"=>"Salutations",
"sup"=>"Sup",
"whatsup"=>"What's up",
"yo"=>"Yo");
//echo greeting
echo (randomArrayVar($greeting));
Hope it’s helpful to someone. If you have an additions please leave them in the comments below.