I have 2 arrays. 1 with items that should always be used and 1 with optional items.
What I want is a list of all possible combinations with these items.
The items in the array have to become attributes with a true or false value.
For example, the arrays
$requiredAttr = array('header', 'footer');
$optAttr = array('image');
Should give the following result:
header="false" footer="false"
header="false" footer="false" image="false"
header="false" footer="false" image="true"
header="true" footer="false"
header="true" footer="false" image="false"
header="true" footer="false" image="true"
header="false" footer="true"
header="false" footer="true" image="false"
header="false" footer="true" image="true"
header="true" footer="true"
header="true" footer="true" image="false"
header="true" footer="true" image="true"
Ofcourse this has the work with any number of items in both arrays.
check this..
change variable name according to your standard..
i print all array for debuging.
http://codepad.org/HK1plx9n
more optimised code
http://codepad.org/pwVOWeRJ