Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. class Model {
  2. public static $table='table';
  3. public static function getTable() {
  4. return self::$table;
  5. }
  6. }
  7. class User extends Model{
  8. public static $table='users';
  9. }
  10. echo User::getTable(); //выведет 'table'
  11.  
  12. class Model {
  13. public static $table='table';
  14. public static function getTable() {
  15. return static::$table;
  16. }
  17. }
  18. class User extends Model{
  19. public static $table='users';
  20. }
  21. echo User::getTable(); //выведет 'users'
  22.  
  23. class Model {
  24. public static $table='table';
  25. public static function foo() {
  26. echo "1_test";
  27. }
  28. }
  29. class User extends Model{
  30. public static function foo() {
  31. echo "2_test";
  32. parent::foo();
  33. }
  34. }
  35. echo User::foo(); //выведет '2_test1_test'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement