Current location: Hot Scripts Forums » Programming Languages » PHP » getting combinations of array index or elements


getting combinations of array index or elements

Reply
  #1 (permalink)  
Old 03-26-06, 04:38 PM
karthikeyan karthikeyan is offline
New Member
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
getting combinations of array index or elements

Hello all,
i have an array named $checked;

$checked[0] = 1;
$checked[1] = 3;
$checked[2] = 4;
$checked[3] = 6;
$checked[4] = 7;


i want to make combinations like
array index
0 1 2 3 means $checked[0]; $checked[1]; $checked[2]; $checked[3];
0 1 2 4
0 1 3 4
0 2 3 4
1 2 3 4
. . . .

like this manner. it should find all the possible combinations.

here i said the sizeof array is five. but it may be 7 , 8 or 3 . if the size of array is 'n' then i want combinations in size of 'n-1' .

is it possible? please help me.

Thank you,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-27-06, 12:11 PM
Crassius Crassius is offline
Newbie Coder
 
Join Date: Mar 2006
Location: Melbourne, FL
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
hope this helps.

I've never written something like that, but seek and ye shall find.
Hope this helps.

http://www.zend.com/codex.php?id=1419&single=1

Good luck.
__________________
~With great power comes great responsibility.~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Usine array elements with <img src= and document.write tacuit JavaScript 3 12-29-04 10:16 PM
Serializing a set of arrays dannyallen PHP 2 10-11-04 04:04 AM
Can I access array elements this way? jack_mcs PHP 3 08-17-04 01:06 AM
How do i return the maximum of the array elements? toezaurus81 C/C++ 1 06-17-04 04:30 PM
linking to iframe not working :( j0d JavaScript 5 01-19-04 09:14 PM


All times are GMT -5. The time now is 09:17 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.