try changing:
        echo "$$temp\n";
to
        echo $$temp."\n";
or even
        echo ${$temp}."\n";
does that work?

-----Original Message-----
From: Thorsten Wandersmann [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 24, 2002 12:16 PM
To: [EMAIL PROTECTED]
Subject: [PHP] to evaluate ...


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Sorry for bothering you, but I really didn't find answeres on dejanews and
in the tutorial, or better, I did not see them.

I need the following variables:

$width1
$width2
$width3
.
.
.
$widthn


Because it is not shure, how many they are, I need to construct them.
And because I need them in a <form> as "name" I could not use arrays (or
did I miss something here???).

So I tried the following, and it works:
(just to look that it works...)

[...]
 $tmp = "bar$z_j";
 while ($z_i <= $$tmp) {
     echo "$$tmp\n";
     $z_i++;
 }
[...]

Ok, now the real problem starts:

 if ($z_bars < $bars) {
   $z_i = 1;
   $rest = 100;
   while ($z_i <= $z_bars) {
      $temp = "width_bar$z_i";
      echo "$$temp\n";
[...]

Guess what, yes!!, it is _not_ working.
So i start to experiment around and also tried to use eval()

but all I ever get was

width_bar1, width_bar2, width_bar3
or even worse
$width_bar1, $width_bar2 ....

and not something like I wanted it:

30, 50, 20

because
width_bar1 should be 30 for example and not to print out width_bar1 ....


I bash I would do it this way:
eval TEMP=\$width_bar$z_i


any ideas?

thorsten

- --
Thorsten Wandersmann     Phone:  +49-911-8172249
Bonhoefferstr. 79        Mobile: +49-179-6670562
90473 Nuremberg          e-Mail: [EMAIL PROTECTED]
Germany                  http://www.caipy.de


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Weitere Infos: siehe http://www.gnupg.org

iD8DBQE8T2A/QkW0pERqT24RApmEAJ96tIQlBdVrglRchK+QY/D/RZi2gACdEgl8
hBlTw6XUBE26hpsv5rG5/yA=
=UCu8
-----END PGP SIGNATURE-----



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to