$struct = array('name' => "", 'id' => "", 'color' => "");
$struct[2]->name
, например. $struct = array('name' => "", 'id' => "", 'color' => ""); //объявление структуры
array_push($struct, array('name' => "111", 'id' => "222", 'color' => "333")); //добавляем элемент
$struct[0]['id']; //обращаемся
<?php
class Struct {
public $id = '';
public $name = '';
public $color = '';
public function __construct($id, $name, $color) {
$this->id = $id;
$this->name = $name;
$this->color = $color;
}
}
$array = [new Struct(0, 'name', '#d00'), new Struct(1, 'name2', '#0d0')];
echo $array[0]->name;
?>