Saturday, 15 January 2011

php - Name a variable after the content of a variable -



php - Name a variable after the content of a variable -

this question has reply here:

php variable variables 6 answers

i'm trying create variable , name after content of variable. example

$newname = "x"; //dosomething create variable $x

they called variable-variables:

${$newname} = 'stuff';

if have more, consider using array , extract variables it:

$vars = array(...); // keys = variable name, value = variable value extract($vars, extr_skip);

php

No comments:

Post a Comment