Traits và sử dụng traits trong PHP
1. Giới thiệu
Nếu là một lập trình viên PHP, chắc hẳn bạn đã từng ít nhất một lần sử dụng traits. Traits được giới thiệu từ PHP 5.4, là một cơ chế giúp ta tái sử dụng code trong các ngôn ngữ đơn kế thừa như PHP. Với traits, ta có thể nhóm các phương thức ta muốn thành một class và sử dụng các phương thức trong traits mà không cần phải kế thừa traits.
Tiếp theo ta sẽ đi tìm hiểu về...
PHP
traits
1493