# БД:
# name | age |
# ------------
# John | 20 |
# Bob | 20 |
# July | 30 |
class Filter
{
public function age()
{
$users = # запрос в бд
foreach ($users as $user)
{
if ($_GET['age'] == 20)
{
return $user->name;
}
elseif ($_GET['age'] == 30)
{
return $user->name;
}
}
}
}
echo Filter::age($user->name);
John
John, Bob
return $user->name;
$user_age = [
["20"] => ["Иван","Света"],
["30"] => ["Катя"]
]