Put them in an array? PHP allows for variable variables, but I'm not sure they
work with classes.

This works:

 $foo0 = 'a';
 $foo1 = 'b';
 $foo2 = 'c';
 $foo3 = 'd';
 $foo4 = 'e';

 for($i = 0 ; $i < 5 ; ++$i)
 {
   $var = 'foo'.$i;
   echo $$var;
 }

Try it with an object...

--Joe


On Fri, Jan 19, 2001 at 05:15:25PM -0500, Michael Zornek wrote:
> ok so i have an object that has (among other things) the following properties:
> 
> $vendor_data->s9
> $vendor_data->s10
> $vendor_data->s11
> $vendor_data->s12
> ...
> $vendor_data->s40
> 
> The values are 1 or 0
> 
> I'd like to write a loop to say:
> 
> for ($count=9; $count>40; $count++) {
>       if ($vendor_data->s(insert_number_here) == 1) {
>               echo something;
>       }
> }
> 
> any thoughts?
> 
> Mike
> 
> -- 
> 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]

-- 

Joe Stump, PHP Hacker
[EMAIL PROTECTED]
http://www.miester.org/


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