My function returns an array and the simplest thing that came to mind to break out the key and value was a foreach()
. How can I get around this workaround?
return array($question."\n" => $answer);
foreach (magic8Ball() as $key => $val) {
echo $key, $val;
};
$ php index.php
Ask a 'yes/no' question. >
Input Error!
$ php index.php
Ask a 'yes/no' question. > Will Sally marry Harry?
Will Sally marry Harry?
Very doubtful.