{ public $username, $age; function setUsername($username) { $this->username = $username; } function setAge($age) { $this->age = $age; } function getUsername() { return $this->username; } function getAge() { return $this->age; } } $memberObj = new member(); $memberObj->setUsername($member['username']); $memberObj->setAge($member['age']); echo json_encode($memberObj); function toUtf($value) { if ($value) { return icon_to_utf8($value); } else { return false; } }