[nycphp-talk] Input as array names
lhall at smartronix.com
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 = somehost.example.com
I can safely get rid of the ".example.com" bit, leaving $hostname as "somehost". What I need to understand is how to take $hostname 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
Bug ID: 3456
At the end I need to print out something like this:
somehost1: 1234, 3456
somehostwehavenotseeninyears: 1234 3456
Recommendations for a neophyte PHP'r?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the talk