variable variables and eval

From: Date: Mon, 13 Aug 2001 14:46:32 +0000
Subject: variable variables and eval
Groups: php.general 
Request: Send a blank email to php-general+get-62440@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi All, i have come across a strange problem with variable variables. Basicly i'm doing the following and its not working: $section = 'data["SITE"][0]["NAME"][0]'; $pData = 'My Site.'; ${sprintf('$%s', $section)}.=$pData; but it is not working. But if i do this: eval('$'.$section.'.="'.addslashes($pData).'";'); it works and all is well. I don't really want to use eval() and just wanted to see if anybody has any ideas why the above doesn't work. Thanks, William. -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 5.0i for non-commercial use Charset: noconv iQA/AwUBO3foS639EoU2VrU1EQIPZgCcCg643+F0xDUXdsBSYAYInFStaJ0An2ID AKL4hMIktbRsQpyVgkoeKsDo =w0ei -----END PGP SIGNATURE-----

« previous php.general (#62440) next »