(PHP 4, PHP 5, PHP 7, PHP 8)
get_class_methods — Sınıf yöntemlerinin isimlerini döndürür
Sınıf yöntemlerinin isimlerini döndürür.
nesne_veya_sınıf
Sınıf veya nesne ismi.
Sınıf yöntemlerinin isimlerini bir dizi olarak döndürür. Hata durumunda null
döner.
Sürüm: | Açıklama |
---|---|
8.0.0 | nesne_veya_sınıf bağımsız değişkeni artık sadece nesneleri veya sınıf isimlerini kabul ediyor. |
Örnek 1 - get_class_methods() örneği
<?php
class myclass {
// kurucu
function __construct()
{
return(true);
}
// 1. yöntem
function myfunc1()
{
return(true);
}
// 2. yöntem
function myfunc2()
{
return(true);
}
}
$class_methods = get_class_methods('myclass');
// veya
$class_methods = get_class_methods(new myclass());
foreach ($class_methods as $method_name) {
echo "$method_name\n";
}
?>
Yukarıdaki örneğin çıktısı:
__construct myfunc1 myfunc2