fork download
  1. <?php
  2. class L {
  3. const login = 'Login';
  4. const title_404 = '404';
  5. const title_dyn = 'Title: %s';
  6. const page_dyn = 'Page: %s - %s';
  7.  
  8. public static function __callStatic($string, $args) {
  9. vsprintf(constant("self::" . $string), $args);
  10. }
  11. }
  12.  
  13. echo L::login . "\n"; // "Login"
  14. echo L::title_404 . "\n"; // "404"
  15. echo L::title_dyn('test') . "\n"; // (empty)
  16. echo L::page_dyn('test', 'more') . "\n"; // (empty)
  17. echo L::login() . "\n"; // (empty)
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Login
404