<?php $boots = [ "title" => ['Россия', 'Великобритания', 'Европа', 'Длина ступни, см'], "size" => [ [34.5, 3.5, 20.4, ['test']], [['test'], 3.6, 20.4, 50.5], [34.5, 3.5, 20.4, ['test'],], [34.5, 3.8, 20.4, 50.5], [34.5, ['test'], 20.4, 50.1], [34.5, 3.5, 20.4, ['test']], [34.6, 3.5, 20.4, 50.5], [34.5, ['test'], 20.4, 50.5], [34.5, 3.5, 20.4, 50.5], [['test'], 3.5, 20.4, 50.1], [34.5, 3.5, 20.4, 50.5], [34.5, 3.1, ['test'], 50.5], [34.5, 3.5, 20.4, 50.5], [34.5, 3.5, 20.4, 50.5], [['test'], 13.5, 20.4, 50.5], [34.5, 3.0, 20.4, 50.5], [34.5, 13.5, 20.4, 50.5], [34.5, 3.5, 20.4, 50.5], [['test'], 3.5, ['test'], 50.5] ] ]; ?> <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Таблица размеров обуви</title> </head> <body> <table border="1"> <caption>Таблица размеров обуви</caption> <tr> <th><?php echo $boots["title"][0]; ?></th> <th><?php echo $boots["title"][1]; ?></th> <th><?php echo $boots['title'][2]; ?></th> <th><?php echo $boots['title'][3]; ?></th> </tr> <?php //for ($i = 0; $i < count($boots['size']); $i++) { foreach ($boots['size'] as $row){ ?> <tr> <td> <? echo $row[0]; ?></td> <td> <? echo $row[1]; ?></td> <td> <? echo $row[2]; ?></td> <td> <? echo $row[3];} ?></td> </tr> </table> </body> </html> //как сделать так чтобы в таблице вместо array выходило значение вложенного значения 'test'?
PHP: <?php $boots = [ "title" => ['Россия', 'Великобритания', 'Европа', 'Длина ступни, см'], "size" => [ [34.5, 3.5, 20.4, ['test']], [['test'], 3.6, 20.4, 50.5], [34.5, 3.5, 20.4, ['test'],], [34.5, 3.8, 20.4, 50.5], [34.5, ['test'], 20.4, 50.1], [34.5, 3.5, 20.4, ['test']], [34.6, 3.5, 20.4, 50.5], [34.5, ['test'], 20.4, 50.5], [34.5, 3.5, 20.4, 50.5], [['test'], 3.5, 20.4, 50.1], [34.5, 3.5, 20.4, 50.5], [34.5, 3.1, ['test'], 50.5], [34.5, 3.5, 20.4, 50.5], [34.5, 3.5, 20.4, 50.5], [['test'], 13.5, 20.4, 50.5], [34.5, 3.0, 20.4, 50.5], [34.5, 13.5, 20.4, 50.5], [34.5, 3.5, 20.4, 50.5], [['test'], 3.5, ['test'], 50.5] ] ]; ?> <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Таблица размеров обуви</title> </head> <body> <table border="1"> <caption>Таблица размеров обуви</caption> <tr> <?php foreach ($boots['title'] as $boot): ?> <th><?php echo $boot; ?></th> <?php endforeach; ?> </tr> <?php foreach ($boots['size'] as $index => $sizes): ?> <tr> <?php foreach ($sizes as $size): ?> <td><?php echo is_array($size) ? $size[0] : $size; ?></td> <?php endforeach; ?> </tr> <?php endforeach; ?> </table> </body> </html>