I want to display data from an array. I had an array like this :
Array
(
[0] => a
[1] => b
[2] => c
[3] => d
)
I try with this script :
$product = array('a','b','c','d');
echo '<table border="1">';
echo '<tr><th>Product 1</th><th>Product 2</th><th>Similarity</th></tr>';
for($i=0; $i<count($product); $i++){
echo '<tr><td>'.$product[$i].'</td><td>'.$product[$i+1].'</td></tr>';
}
echo '</table>';
but I'm confused and tried but always wrong to get an output in table as follows :
| Data 1 | Data 2 |
| a | b |
| a | c |
| a | d |
| b | c |
| b | d |
| c | d |
and so on according to the length of the array