Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<opcache_resetInstalling/Configuring>
^Affecting PHP's BehaviourLast updated: Mon, 26 Oct 2026

Operator Overloading for Objects

Introduction

This extension defines and implements operator overloading for objects. It allows defining how an object reacts when an operator is used on it.

One example of this is creating a collection type object that has the addition operator overloaded to allow adding elements to the collection or adding two collections together.

Another example is creating an enhanced string class that has the multiplication operator overloaded to allow repeating the string a certain number of times.


<opcache_resetInstalling/Configuring>
^Affecting PHP's BehaviourLast updated: Mon, 26 Oct 2026