В С# возможно создать массив объектов, без создания отдельного класса:
object[] anonymousObj = new object[] {
new { firstName = "Petya", lastName = "Kukovich", patronymic = "Olegovich" },
new { firstName = "Alexey", lastName = "Muchacha", patronymic = "Viktorovich" },
new { firstName = "Olga", lastName = "Nahurina", patronymic = "Vycheslavovna" }
};
В js:
const anonymousObj = [
{
firstName: "Petya",
lastName : "Kukovich",
patronymic: "Olegovich"
},
{
firstName: "Alexey",
lastName : "Muchacha",
patronymic: "Viktorovich"
},
{
firstName: "Olga",
lastName : "Nahurina",
patronymic: "Vycheslavovna"
}
];
Как подобным образом можно реализовать в Php не создавая отдельный класс?