extract() question
| From: | David Bernier | Date: | Sun, 18 Nov 2001 21:21:46 +0000 |
| Subject: | extract() question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-75038@lists.php.net to get a copy of this message | ||
There is this array which I would like to convert into a series variables using the extract
function:
<?
$oz = array(
"lion" => "courage",
"dorothy" => "kansas",
"scarecrow" => "brain"
"tin man" => "heart");
extract($oz);
?>
now, I would like to access my new variables. it is obviously easy for $lion, $dorothy, and
$scarecrow but it isn't for "tin man".
from this, I have 3 or 4 questions:
1) has $oz["tin man"] been passed into a variable?
2) if yes, how do I access the variable that came out of $oz["tin man"]?
3) let's pretend that I have no control over the names of the keys for $oz, how should I have
called extract() to tell it to replace the space between "tin" and "man" by a
underscore character?
4) finally, is there a way to access and retrieve that values of the symbol table without knowing
their names?
David