Explain the concept of 'Asymmetric Visibility' introduced in PHP 8.4. When would you use it?

Last updated 15 June 2026

  • Asymmetric visibility (PHP 8.4) gives one property separate read and write scopes, e.g. public private(set) int $count; means public read, private write.

  • It removes getter boilerplate. Unlike readonly (one write, then locked), it allows many writes, but only from the allowed scope.

  • Use it for entity/value objects whose state outsiders may read but only the class (or subclasses via protected(set)) may change.

  • https://en.wikipedia.org/wiki/PHP
  • https://lemon.io/for-developers/php-developer-jobs/
  • https://lan-portal.uob.edu.ly/visit/BOOK/529X432U02/modern-php_new__features_and_good-practices.pdf
  • https://lan-portal.uob.edu.ly/upload/MD/D57953S372/modern-php__new_features_and__good__practices.pdf
  • https://news.ycombinator.com/item?id=30786927
  • https://kvnc-inc.medium.com/solid-principles-in-php-1c41069e9af6
  • https://www.shkodenko.com/
  • https://confoo.ca/en/2024/sessions
All PHP interview questions