I am creating response from objects return from MySQL result
$q=mysql_query("SELECT userid,fullname FROM users");
while($r=mysql_fetch_objects($q)){
$ar[]=$r;
}
echo json_encode($ar);
Here $r has two properties userid and fullname.
Now I want to add a new property to $r object. How can I do this?
In this case $r should just be a standard object, so you can just do: