I'm trying to figure out how to get value from associative array by putting a function inside a while statement?
while($row = $result->fetch_assoc()) {
$message = $row["message"];
$reply = $row["reply"];
$object->gets("'.$message.'", function ($obj) {
$obj->posts("'.$reply.'");
});
}
Obviously that code wont work because the variable $reply
needs to be initialized inside the function to work. How can I do this procedural style? Or is there a better way to do this?