What is the difference between an object and an array in PHP?

In PHP, an object is a data structure that stores data and functions related to that data, while an array is a data structure that stores multiple values in a single variable. Objects are instances of classes and can have properties and methods, while arrays are indexed collections of values. To create an object, you define a class and instantiate it using the `new` keyword, while arrays can be created using square brackets.

// Creating an object
class Person {
    public $name;
    public $age;
}

$person = new Person();
$person->name = "John";
$person->age = 30;

// Creating an array
$colors = ["red", "green", "blue"];