Crisp
01-06-2010, 07:48 PM
Hey,
Using return in a function will only execute it once, correct?
After it's executed, it will end and won't do it again (Say if you have a while loop)
What I want, is it to return and return the code ever how many times it needs to loop (For loop)
Which is impossible using return.
What I'd like to know, is if there is something very very similar to return that will do that, or another way.
Here's what I have:
class Features
{
function stars($id) //Usergroup stars
{
global $queries;
$usergroups = $queries->groupQuery("`id`='$id'");
$usergroup = mysql_fetch_array($usergroups);
//Value
for ($stars = 1; $stars <= $usergroup['stars']; $stars++)
{
$star = "<img src='images/skins/default/stars/admin_star.png' alt='Star' />";
return $star;
}
}
}
And now to call it,
class Thread
{
function threads()
{
$features->stars($userg['id']);
}
}
Thanks. :)
Using return in a function will only execute it once, correct?
After it's executed, it will end and won't do it again (Say if you have a while loop)
What I want, is it to return and return the code ever how many times it needs to loop (For loop)
Which is impossible using return.
What I'd like to know, is if there is something very very similar to return that will do that, or another way.
Here's what I have:
class Features
{
function stars($id) //Usergroup stars
{
global $queries;
$usergroups = $queries->groupQuery("`id`='$id'");
$usergroup = mysql_fetch_array($usergroups);
//Value
for ($stars = 1; $stars <= $usergroup['stars']; $stars++)
{
$star = "<img src='images/skins/default/stars/admin_star.png' alt='Star' />";
return $star;
}
}
}
And now to call it,
class Thread
{
function threads()
{
$features->stars($userg['id']);
}
}
Thanks. :)