[PHP] combining two variables to make one???

2003-12-22 Thread Tristan . Pretty
I want to out put three bits of text...
I want my end page to look like this...

=
result 1
result 2
result 3
=

here's the code I've got...

===
?
$i = 1;
while ($i = 3) {
$options$i = result $i;
}
?
html
body
?=$option1 ?
?=$option2 ?
?=$option3 ?
/body
/html
===

yet I get an error...?
Anyone know who to make $option$i work?


*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***



Re: [PHP] combining two variables to make one???

2003-12-22 Thread Chris Boget
 ?
 $i = 1;
 while ($i = 3) {
 $options$i = result $i;
 }
 ?

You want this:

${$options{$i}} = result $i;

For the sake of clarity I typically do something like the following:


$i = 1;
while ($i = 3) {
  $varName = $options . $i;

  ${$varName} = result $i;

}

Chris

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



Re: [PHP] combining two variables to make one???

2003-12-22 Thread Tristan . Pretty
Cheers...
Doesn't work for me though...?

What do the '{' mean when declaring the variable?







Chris Boget [EMAIL PROTECTED] 
22/12/2003 14:16

To
[EMAIL PROTECTED], [EMAIL PROTECTED]
cc

Subject
Re: [PHP] combining two variables to make one???






 ?
 $i = 1;
 while ($i = 3) {
 $options$i = result $i;
 }
 ?

You want this:

${$options{$i}} = result $i;

For the sake of clarity I typically do something like the following:


$i = 1;
while ($i = 3) {
  $varName = $options . $i;

  ${$varName} = result $i;

}

Chris

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




*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***



Re: [PHP] combining two variables to make one???

2003-12-22 Thread Chris Boget
 Doesn't work for me though...?

Which isn't working?  

This:

${$options{$i}} = result $i;

or this:

$i = 1;
while ($i = 3) {
  $varName = $options . $i;

  ${$varName} = result $i;

}

 
 What do the '{' mean when declaring the variable?

I can't remember where it is in the documentation, but the '{' '}' symbols
basically clear up any ambiguity for the parser indicatig where the actual
variables are in a statement.

Chris

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



Re: [PHP] combining two variables to make one???

2003-12-22 Thread Tristan . Pretty
I am a monkey...
I had me angle bracket the wrong way round... what a stoner...!




Chris Boget [EMAIL PROTECTED] 
22/12/2003 15:04

To
[EMAIL PROTECTED]
cc
[EMAIL PROTECTED]
Subject
Re: [PHP] combining two variables to make one???






 Doesn't work for me though...?

Which isn't working? 

This:

${$options{$i}} = result $i;

or this:

$i = 1;
while ($i = 3) {
  $varName = $options . $i;

  ${$varName} = result $i;

}

 
 What do the '{' mean when declaring the variable?

I can't remember where it is in the documentation, but the '{' '}' symbols
basically clear up any ambiguity for the parser indicatig where the actual
variables are in a statement.

Chris

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




*
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***