[nycphp-talk] Input as array names

Hall, Leam lhall at
Tue Aug 25 15:27:51 EDT 2009

 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] =

I can safely get rid of the "" 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. 

For example, my text file looks something like this:

Bug ID:  1234
Affected Machines:

Bug ID:  3456
Affected Machines:

At the end I need to print out something like this:

somehost1:  1234, 3456
somehost2:  1234
somehostwehavenotseeninyears:  1234 3456

Recommendations for a neophyte PHP'r?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the talk mailing list