Hi,
function createvar($name, $value)
{
$GLOBALS[$name] = $value;
}
Or do it without a function:
$GLOBALS['name'] = $value;
--
Richard Heyes
HTML5 Graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated January 17th)
--
PHP General Mailing List (http://www.php.net
No, that's not the point yet.
-Mensagem original-
De: Robert Stankiewicz [mailto:robe...@belfabriek.nl]
Enviada em: quinta-feira, 22 de janeiro de 2009 10:49
Para: Jônatas Zechim; php-general@lists.php.net
Assunto: Re: [PHP] Create $var with some function
> function c
function createvar($var) {
${$var} = 'foo';
global ${$var};
//or global $$var, i don't know it yet.
}
This should work.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi there,
Someone know if can (if possible, how) i create a $var on my script like this:
function createvar($var) {
$var = 'foo';
global $var;
//or global $$var, i don't know it yet.
}
so i'd call,
createvar('myvar');
so
4 matches
Mail list logo