RE: [PHP] Re: Variable wildcards

From: Date: Fri, 12 Apr 2002 06:17:31 +0000
Subject: RE: [PHP] Re: Variable wildcards
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-92721@lists.php.net to get a copy of this message
Following on the same subject (kinda) of Variable Variables... i have actually wondered this before... is there a difference between these 2 blocks?? (both should print "worldhello" if i am not mistaken, but is there a difference in how the nested variable is handled when it's inside curly braces?): $a = "hello"; $hello = "world"; print($$a.$a); ------ and ------ $a = "hello"; $hello = "world"; print(${$a}.$a); -----Original Message----- From: Jason Bell [mailto:jbell@barkingrat.com] Sent: Thursday, April 11, 2002 7:33 PM To: php-general@lists.php.net Subject: [PHP] Re: Variable wildcards This would certainly work, but I got a suggestion for using <select name="array[]" multiple> that i think will be a much cleaner solution. Thanks! ----- Original Message ----- From: "Philip Hallstrom" <philip@adhesivemedia.com> To: "Jason Bell" <jbell@barkingrat.com> Cc: <php-general@lists.php.net> Sent: Thursday, April 11, 2002 4:10 PM Subject: Re: Variable wildcards > If you want to process the list when they submit the form you can do > something like this: > > foreach($_REQUEST as $key => $value ) { > if( ereg("user([0-9]*)", $key, $match_ary) ) { > #go crazy; > } > } > > ?? > -philip > > On Thu, 11 Apr 2002, Jason Bell wrote: > > > Yeah, I thought so too, but variable variables doesn't seem to provide for > > this.... to add a little bit of detail to what I am doing, it is a user > > list, and I want to have a check box next to each user so that you can > > select 1 or more users for deletion. Each checkbox will be named User$id > > ($id of course being the numerical id of the user in the database) > > > > > > I did try doing somehting like $User{ereg ([0-9])} but it doesn't seem to > > work, or I'm doing it wrong. > > > > > > I guess maybe an easier way is if I could somehow drop all of the selected > > id's into an array? Then I wouldn't need to worry about needing to determine > > which variables exist. > > > > > > ----- Original Message ----- > > From: "Kevin Stone" <kevin@helpelf.com> > > To: "Jason Bell" <jbell@barkingrat.com>; <php-general@lists.php.net> > > Sent: Thursday, April 11, 2002 3:44 PM > > Subject: Re: Variable wildcards > > > > > > > Sounds like what you want is Variable Variables. > > > > > > http://www.php.net/manual/en/language.variables.variable.php > > > > > > ----- Original Message ----- > > > From: "Jason Bell" <jbell@barkingrat.com> > > > To: <php-general@lists.php.net> > > > Sent: Thursday, April 11, 2002 4:24 PM > > > Subject: Variable wildcards > > > > > > > > > are there wildcard characters for variables? > > > > > > Lets say that I have a varable that always starts with $user but then has > > > the 2 digit user id attached to the end, so it could be $user12 or $user28 > > > > > > > > > is there a way to grab these? sort of like in unix standards, where I > > could > > > use user?? or user* ? > > > > > > > > > Thanks! > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#92721) next »