Как обратиться к элементу массива php — Q&A Хекслет
2026-02-26 18:15 Diff
<?php // Обычный массив: $collection1 = ['hexlet', 'is', 'awesome']; // [ // "hexlet", // "is", // "awesome", // ] $collection1[0]; // "hexlet" $collection1[2]; // "awesome" // Ассоциативный массив: $collection2 = ['hexlet' => ['is', 'awesome', null], 'somesing' => 'amazing']; // [ // "hexlet" => [ // "is", // "awesome", // null, // ], // "somesing" => "amazing", // ] $collection2['hexlet']; // [ // "is", // "awesome", // null, // ] $collection2['hexlet'][1]; // "awesome"