Re: [PHP] variable string names

2003-03-09 Thread Edwin Boersma
John's solution is the better one. But if you really wish to stick to your own, try and use eval() to complile $where$i. Edwin John W. Holmes wrote: I have: if ($where1 != '') { $whereArray = array_push($whereArray, $where1); } and I want to repeat for $where1 up to $where8 but ra

RE: [PHP] variable string names

2003-03-08 Thread John W. Holmes
> I have: > > if ($where1 != '') > { > $whereArray = array_push($whereArray, $where1); > } > > and I want to repeat for $where1 up to $where8 > > but rather than write it out 8 times, I'd rather use a loop > > for ($i=1; $i<=8 i++) > { > if ($where1 != '') > { > $whe

Re: [PHP] variable string names

2003-03-08 Thread Liam Gibbs
You could probably do this. Set up a $$where variable, which would contain "where" . $i, $i being the iterator of your loop. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] variable string names

2003-03-08 Thread Leif K-Brooks
for ($i=1; $i<=8 i++) { if (${'where'.$i} != '') { $whereArray = array_push($whereArray, ${'where'.$i}); } } julian haffegee wrote: Hi all, I have something thats been driving me mad for days I have: if ($where1 != '') { $whereArray = array_push($whereArray, $where1);