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:[EMAIL PROTECTED]]
Sent: Thursday, April 11, 2002 7:33 PM
To: [EMAIL PROTECTED]
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" <[EMAIL PROTECTED]>
To: "Jason Bell" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
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" <[EMAIL PROTECTED]>
> > To: "Jason Bell" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > 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" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > 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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to