On Tue, Aug 25, 2009 at 10:40 PM, Michael Hernandez <[email protected]>wrote:
> On Tue, 2009-08-25 at 15:27 -0400, Hall, Leam wrote: > > Okay, here's one of the places I don't really get and can use some > > help on. On my text processing script I'm going to slurp up host > > names. They come in as the first, counting from 0, element. I can > > explode and create the array, which gives me a string: > > > > $hostname[1] = somehost.example.com > > > > I can safely get rid of the ".example.com" bit, leaving $hostname[1] > > as "somehost". What I need to understand is how to take $hostname[1] > > and make it an array in it's own right so I can assign it a list of > > numbers. > > > With variable variable names, > > if $hostname[1] = somehost > > $$hostname[1] = array(); > > now you have an array named $somehost > > --Mike H > > PS I didn't try it, don't hate me :) > > _______________________________________________ > New York PHP User Group Community Talk Mailing List > http://lists.nyphp.org/mailman/listinfo/talk > > http://www.nyphp.org/show_participation.php > Or $hosts[$hostname[1]] = array($bugID1, $bugID2 ...) foreach( $hosts as $key=>$value){ echo "$key : ". implode(',' , $value); } -- Numai bine, Cristian
_______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show_participation.php
