Php Immutable objects

Mutable and immutable classes

A class that contains any methods(not a constructor) that change any of the data in an object of the class is called mutable.

“Mutable” means that something can be changed, and “Immutable” — that something is stable.

That means the mutable objects are those whose data can be changed after the instance is created.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store