I have the following class:
<?php
class L {
const login = 'Login';
const title_404 = '404';
const title_dyn = 'Title: %s';
const page_dyn = 'Page: %s - %s';
public static function __callStatic($string, $args) {
vsprintf(constant("self::" . $string), $args);
}
}
It won't replace %s by passed arguments:
L::login; --> Login
L::title_404; --> 404
L::title_dyn('test'); --> empty
L::page_dyn('test', 'more'); --> empty
L::login(); --> empty
I should get with L::title_dyn('test'); --> "Title: test"
What I'm doing wrong?