Witam, Chciałbym z tablicy:
Array (
[1] => Array (
[ral] => 1000
[r] => 190
[g] => 189
[b] => 127
[hex] => BEBD7F
[lpl] => beżowo-zielony
[alternativs] => Array (
[0] => 2020-Y
[1] => 2020-G90Y
[2] => 2020-Y10R
[3] => 2020-G80Y
[4] => 2020-Y20R
[5] => 4535 C
[6] => 5855 C
[7] => 7502 C
)
[aranges] => Array
(
[0] => 0
[1] => 0
[2] => 0
[3] => 0
[4] => 0
[5] => 1
[6] => 1
[7] => 1
)
[aratings] => Array
(
[0] => 4
[1] => 2
[2] => 1
[3] => 1
[4] => 3
[5] => 2
[6] => 2
[7] => 1
)
)
)
Uzyskać taki efekt:
+-----------+------------------------------------------+----------------+
| RAL: | [ral] | [lpl] |
| |------------------------------------------| |
| NCS 1950: | [alternativs]-[aranges][0]-[aratings][0] | |
| | [alternativs]-[aranges][1]-[aratings][1] | |
| | [alternativs]-[aranges][2]-[aratings][2] | |
| | [alternativs]-[aranges][3]-[aratings][3] | |
| | [alternativs]-[aranges][4]-[aratings][4] | |
| |------------------------------------------| |
| Pantone: | [alternativs]-[aranges][5]-[aratings][5] | |
| | [alternativs]-[aranges][6]-[aratings][6] | |
| | [alternativs]-[aranges][7]-[aratings][7] | |
| |------------------------------------------| |
| RGB: | [r]-[g]-[b] | |
| HEX: | [hex] | |
+-----------+------------------------------------------+----------------+
Czyli wizualnie:
+-----------+-------------+----------------+
| RAL: | 1000 | beżowo-zielony |
| | ----------- | |
| NCS 1950: | 2020-Y | |
| | 2020-G90Y | |
| | 2020-G80Y | |
| | 2020-Y10R | |
| | 2020-Y20R | |
| | ----------- | |
| Pantone: | 4525 C | |
| | 5855 C | |
| | 4535 C | |
| | ----------- | |
| RGB: | 190-189-127 | |
| HEX: | BEBD7F | |
+-----------+-------------+----------------+
W HTML to było by tak:
<tr>
<td>
RAL:<br />
NCS 1950:<br />
<!-- tyle BR, ile [alternativs]-[aranges][0] -1 -->
Pantone:<br />
<!-- tyle BR, ile [alternativs]-[aranges][1] -1 -->
RGB:<br />
HEX:
</td>
<td>
[ral]
<hr>
[alternativs]-[aranges][0]-[aratings][0]
[alternativs]-[aranges][1]-[aratings][1]
[alternativs]-[aranges][2]-[aratings][2]
[alternativs]-[aranges][3]-[aratings][3]
[alternativs]-[aranges][4]-[aratings][4]
<hr>
[alternativs]-[aranges][5]-[aratings][5]
[alternativs]-[aranges][6]-[aratings][6]
[alternativs]-[aranges][7]-[aratings][7]
<hr>
[r]-[g]-[b]
[hex]
</td>
<td>
[lpl]
</td>
</tr>
Może nie jest to skomplikowane, ale nie umiem sklecić warunku. Cokolwiek napiszę, to się sypie.
<?php
foreach ($color['alternativs'] as $alternativ) {
if(isset($arange) AND $aranges == '0') {
if(isset($alternativ) AND $alternativ == '0') {
echo $alternativ.'<br />';
}
}
}
?>