I have a query that gets some data from a DB and I save that to a PHP variable.
I was wondering how I could pass the PHP variable to a JSON variable?
IE:
$content = $row['content'];
class Foo
{
public $a = "$content";
}
$obj = new Foo();
echo json_encode($obj);
Can anyone help me out?
THanks!
1 Answer