RE: [PHP] Variable Next To Variable?

From: Date: Wed, 11 Jul 2001 17:23:18 +0000
Subject: RE: [PHP] Variable Next To Variable?
Groups: php.general 
Request: Send a blank email to php-general+get-57440@lists.php.net to get a copy of this message
I think you want if (!(${"C_Last_Name$y"})) { or if (!(${"C_Last_Name".$y})) { -----Original Message----- From: Jeff Oien [mailto:jeff@webdesigns1.com] Sent: Wednesday, July 11, 2001 10:22 AM To: PHP Subject: RE: [PHP] Variable Next To Variable? I like this idea but it's giving me a parse error on this code: if (!{$C_Last_Name}{$y}) I'm looking at the other ideas also. Jeff Oien > > if (!$C_Last_Name$y) { > > The form submitting information to this code has field name like > > C_Last_Name1 C_Last_Name2 depending on how many Children > > are signing up for something. So I need $y to represent the number. > > You want this: > > if (!{$C_Last_Name}{$y}) { > > The {} surrounding the variable name tells PHP that those are > unique entities/variables. For example, you could use the following: > > echo "Hello, {$userInfo->printFirstName()}"; > > to interpolate a class' method call within a string... > > Chris > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#57440) next »