Re: list all constitute group of array ?
| From: | Shawn McKenzie | Date: | Sat, 14 Feb 2009 01:09:18 +0000 |
| Subject: | Re: list all constitute group of array ? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-288244@lists.php.net to get a copy of this message | ||
Shawn McKenzie wrote:
> Robert Cummings wrote:
>> On Sat, 2009-02-14 at 07:41 +0800, LKSunny wrote:
>>> <?
>>> $a = array("a", "b", "c", "d");
>>>
>>> /*
>>> how to list:
>>> abcd
>>> abc
>>> ab
>>> ac
>>> ad
>>> bcd
>>> bc
>>> bd
>>> cd
>>> a
>>> b
>>> c
>>> d
>>>
>>> who have idea ? thank you very much !!
>>> */
>>> ?>
>> This looks like homework. Use recursion.
>>
>> Cheers,
>> Rob.
>
> Well, I don't know how you list them in that pattern, you need to write
> an algorithm, but array_keys() will give keys for the array.
>
Or, if I actually read your post they are values, so maybe
array_values() or you can check http://php.net/manual/book.array.php and
hope you get an A.
--
Thanks!
-Shawn
http://www.spidean.com