class User extends CActiveRecord { public function __set($name, $value) { if ($name === 'age') { // convert age to an integer before setting $this->attributes['age'] = (int) $value; } else { parent::__set($name, $value); } } } $user = new User; $user->name = 'John'; $user->age = '25'; echo $user->age; // outputs 25In this example, the `User` model has a `__set` method that intercepts the `age` property when it is set. It converts the value to an integer before setting the attribute on the model. This code example likely belongs to the Yii Framework, as `CActiveRecord` is a core class in that framework.