What are the advantages and disadvantages of using classes in PHP to mimic the functionality of records?

Using classes in PHP to mimic the functionality of records allows for better organization and encapsulation of data, making it easier to manage and manipulate. However, it can also introduce complexity and overhead, especially for simple data structures. It is important to weigh the benefits of using classes against the potential drawbacks in terms of performance and code readability.

class Record {
    public $field1;
    public $field2;
    
    public function __construct($field1, $field2) {
        $this->field1 = $field1;
        $this->field2 = $field2;
    }
}

$record = new Record('value1', 'value2');
echo $record->field1;
echo $record->field2;