Re: [PHP] How printing the name and value of a variable ?

2002-10-31 Thread PHP List
Why?
echo "THE VARIABLE ".(please help me right here)." EQUALS ".$tigidizougou;

Obviously the variables name is tigidizougou, so just do this:

echo "THE VARIABLE  tigidizougou EQUALS ".$tigidizougou;

Or am I missing something here?


> Theoriquement it is not possible, because you cannot use any variable
since
> you don't know its name-
>
> But you can cope something with get_defined_vars() in which you set every
> variable without distinction into an array- and after you select the
> variable you need using some criterias.
>
> like this
> $array = get_defined_vars() ;
> foreach ($array as $key=>$value)
> if (ereg("EREG_CRITERIA",$key))  echo "La variable $KEY est egale a
$value"
> ;
>
> Elsewhere if you know the name of the variable you would like to use
> do simply like this:
>
> $tigidizougou = 12;
> echo "THE VARIABLE tigidizougou EQUALS ".$tigidizougou;
>
>
> - Original Message -
> From: "franck raynal" <[EMAIL PROTECTED]>
> To: "php-general" <[EMAIL PROTECTED]>
> Sent: Friday, November 01, 2002 9:09 AM
> Subject: [PHP] How printing the name and value of a variable ?
>
>
> Hello,
> I'd like to print the name of a variable, in order to get something like
> this  :
>
> THE VARIABLE tigidizougou EQUALS 12 !
>
> from the original code below :
>
> $tigidizougou = 12;
> echo "THE VARIABLE ".(please help me right here)." EQUALS ".$tigidizougou;
>
> Any idea ? Thanks you.
>
> Franck
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] How printing the name and value of a variable ?

2002-10-31 Thread rija
Theoriquement it is not possible, because you cannot use any variable since
you don't know its name-

But you can cope something with get_defined_vars() in which you set every
variable without distinction into an array- and after you select the
variable you need using some criterias.

like this
$array = get_defined_vars() ;
foreach ($array as $key=>$value)
if (ereg("EREG_CRITERIA",$key))  echo "La variable $KEY est egale a $value"
;

Elsewhere if you know the name of the variable you would like to use
do simply like this:

$tigidizougou = 12;
echo "THE VARIABLE tigidizougou EQUALS ".$tigidizougou;


- Original Message -
From: "franck raynal" <[EMAIL PROTECTED]>
To: "php-general" <[EMAIL PROTECTED]>
Sent: Friday, November 01, 2002 9:09 AM
Subject: [PHP] How printing the name and value of a variable ?


Hello,
I'd like to print the name of a variable, in order to get something like
this  :

THE VARIABLE tigidizougou EQUALS 12 !

from the original code below :

$tigidizougou = 12;
echo "THE VARIABLE ".(please help me right here)." EQUALS ".$tigidizougou;

Any idea ? Thanks you.

Franck


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php