Tuesday, July 8, 2008

dynamic variable

This article talks about different ways to compose dynamic Javascript variable -


eval('name' + i + ' = "Marco"'); // compose a string with variable as eval's argument
window['name' + i] = 'Marco';

And the PHP counterpart is:

${'name'.$i} = 'Marco';
echo 'ap_bVNSRadio_${vname}';

No comments: