RE: [PHP] to evaluate ...

2002-01-23 Thread Martin Towell

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. 79Mobile: +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]



Re: [PHP] to evaluate ...

2002-01-23 Thread hugh danaher

If your heart is set upon using $width1... then write your variable like in
the following:

for ($i=1;$i=$some_end_number;$i++)
{
${width.$i}=something width;
}

hugh
- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: Thorsten Wandersmann [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, January 23, 2002 6:42 PM
Subject: Re: [PHP] to evaluate ...


 On Thursday 24 January 2002 09:15, Thorsten Wandersmann wrote:
  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???).

 Yes, you're missing something :) You can use arrays in forms, just use
names
 like width[0], width[1] etc.

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk

 /*
 Goto, n.:
 A programming tool that exists to allow structured programmers
 to complain about unstructured programmers.
 -- Ray Simard
 */

 --
 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]



-- 
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]