Im relatively new to PHP, but realized that it is a powerful tool. So excuse my ignorance here.
I want to create a set of objects with default functions.
Therefore, instead of calling a function in a class, we can simply output the class / object variable and execute the default function using the toString () method.
Question: Is there a way to define a default function in a class?
Example
class String { public function __construct() { }
Using
$str = new String(...); print($str);
source share