Mô tả
Hàm get_class_methods() lấy tên các phương thức của lớp. Trả về mảng tên phương thức được định nghĩa cho lớp. Trả về NULL nếu lỗi.
Cú pháp
get_class_methods(class)
Tham số
name_of_class − Tên lớp. Bắt buộc.
Giá trị trả về
Trả về mảng tên phương thức, NULL nếu lỗi.
Ví dụ
<?php
class Demo {
function Demo() { return true; }
function displayOne() { return true; }
function displayTwo() { return true; }
}
$method = get_class_methods('Demo');
$method = get_class_methods(new Demo());
foreach ($method as $method_name) {
echo "$method_name \n";
}
?>Kết quả
Demo displayOne displayTwo