Re: Confused about the list() function

From: Date: Wed, 17 Jul 2002 16:48:29 +0000
Subject: Re: Confused about the list() function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-108119@lists.php.net to get a copy of this message
D> Hi, D> I have the following situation. I have an array of colors that I would like to print out. My D> first course of action would be to convert the array to a string so that I can parse it. My command D> would be: D> $color_list = explode(",", $color); D> Now that I have a string of colors delimited by commas, I would like to parse the string and D> print out all my colors. I have read the documentation on using the list() function but I find it D> confusing. Can someone clear the fog from my mind please? D> Thanks, D> Don Assuming you have an array of colors called $color (and assuming I haven't misread or misinterpreted any information), you can do the following to directly print your colors. // Prints out all colors comma-separated. print(join(", ", $color)); // Prints out all colors linebreak-separated (HTML-wise). print(join("<br>", $color)); -- Best regards, Asmodean mailto:asmodean@lka.nu

« previous php.general (#108119) next »