<?php
class Base {
public static function __callStatic($method, $args) {
if ($method == 'new')
echo 'Base::new() called successfully';
}
public function __call($method, $args) {
if ($method == 'new')
echo '$base->new() called successfully';
}
}
$base = Base::new();
call_user_func(array('Base', 'new'));
$base = new Base;
$base->new();
Base::new() called successfullyBase::new() called successfully$base->new() called successfully
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Base::new() called successfullyBase::new() called successfully$base->new() called successfully
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Parse error: syntax error, unexpected 'new' (T_NEW) in /in/clKJj on line 14
Process exited with code 255.