Evaluate String as Object
| From: | bubba | Date: | Thu, 11 Nov 2004 15:28:20 +0000 |
| Subject: | Evaluate String as Object | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-201774@lists.php.net to get a copy of this message | ||
Hi,
Is it possible to evaluate a string passed to a script as an object?
If, for example, I have the following executing in my script:
$result = $player_1->execute_query();
// OR
$result = $player_2->execute_query();
If I pass a value to a script in the following manner, say:
$playername = $_GET["playername"];
Can I convert/evaluate this as an object, i.e.:
$result = [VALUE-OF-$playername]->execute_query();
I'd rather not be in a position where I'm doing a raft of if/then
statements....
Cheers,
bub.