Re: combining variables...

From: Date: Tue, 06 Apr 2004 18:15:56 +0000
Subject: Re: combining variables...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-182512@lists.php.net to get a copy of this message
Guess it will work this way (think it's the right syntax :-)) for ($i = 1; $i <= 6; $i++) { if (${'view_request_bu_'.$i} != '') { ... } } etc pp. Am Dienstag, 6. April 2004 19:24 schrieb Tristan.Pretty@risk.sungard.com: > Sadly, it didnb't work... > > here's my code... I wanna repeat and output final variables 6 times... > > ====================================== > > for ($i = 1; $i <= 6; $i++) { > > if ($view_request_bu_$i != '') { > $view_request_$i = strtolower($view_request_bu_$i); > } else if ($view_request_email_$i != '') { > $view_request_$i = strtolower($view_request_email_$i); > } else if ($view_request_company_$i != '') { > $view_request_$i = strtolower($view_request_company_$i); > } else if ($view_request_datestart_$i != '') { > $view_request_$i = "date"; > } else if ($view_request_filename_$i != '') { > $view_request_$i = strtolower($view_request_filename_$i); > } else if ($view_request_filecat_$i != '') { > $view_request_$i = strtolower($view_request_filecat_$i); > } else if ($view_request_filetype_$i != '') { > $view_request_$i = strtolower($view_request_filetype_$i); > } else if ($view_request_display_name_$i != '') { > $view_request_$i = > strtolower($view_request_display_name_$i); > } else if ($view_request_region_$i != '') { > $view_request_$i = strtolower($view_request_region_$i); > } else if ($view_request_id_$i != '') { > $view_request_$i = strtolower($view_request_id_$i); > } else { > $view_request_$i = "Error"; > } > > } > > ===================================== > > > > > > Richard Davey <rich@launchcode.co.uk> > 06/04/2004 18:27 > Please respond to > Richard Davey <rich@launchcode.co.uk> > > > To > php-general@lists.php.net > cc > > Subject > Re: [PHP] combining variables... > > > > > > > Hello Tristan, > > Tuesday, April 6, 2004, 6:14:19 PM, you wrote: > > TPrsc> Simply put, can I connect 2 variables, to make one... > > TPrsc> I want to output: > TPrsc> $view_request_$i > > TPrsc> making for example a string: > TPrsc> view_all_2 > > I believe it's $view_request_$$i > > -- > Best regards, > Richard Davey > http://www.phpcommunity.org/wiki/296.html > > -- > 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. > ***********************************************************************

« previous php.general (#182512) next »