I would like to learn how to create a Function in PHP.
(Hold my hand… I’m scared!!!)
Here is some code that I have which is mucking up my page, and I’m thinking this might be a good candidate for a Function…
// Display Online Status.
$minutesOnline = (time() - strtotime($lastActivity))/60;
if ($minutesOnline < 15){
// Member Online
echo ' <img src="/images/Light_Green_10.png" width="10"
alt="Member Status: Online"
title="Green Light. Credit: 1RadicalOne, Wikimedia Commons." />
<br />';
}else if ($minutesOnline < 30){
// Member Idle
echo ' <img src="/images/Light_Yellow_10.png" width="10"
alt="Member Status: Idle"
title="Yellow Light. Credit: 1RadicalOne, Wikimedia Commons." />
<br />';
}else{
// Member Offline
echo ' <img src="/images/Light_Gray_10.png" width="10"
alt="Member Status: Offline"
title="Gray Light. Credit: 1RadicalOne, Wikimedia Commons." />
<br />';
}
Actually, I guess my first question should have been…
Can I assign echo statements like above to a variable? (I’m just used to saying $balance=100;)
If I could pass in the last time the Member was active and then get back the HTML I need to display the Member’s Online Status that would be helpful.
Sorry if this is a lame thread, but all part of being a newbie!!!
Debbie