**************************************************
21. dirname
Belirli bir yol için dizinin adını döndürür.
PHP- Kodu
<?php
echo dirname("/path/script.php");
?>
**************************************************
22. function_exists
PHP betiğinde bir işlev olup olmadığını kontrol eder.
PHP- Kodu
<?php
function displayMsg()
{
echo "Welcome to Code4Example";
}
// Checks if the function named displayMsg exists or not
if (function_exists ('displayMsg'))
{
echo "The displayMsg () function exists.\n";
}
else
{
echo "The displayMsg () function does not exist.\n";
}
?>
**************************************************
23. array_map
Bir dizinin her bir değerini kullanıcı tanımlı bir işleve gönderir ve kullanıcı tanımlı işlev tarafından sağlanan yeni değerlerle bir dizi döndürür.
PHP- Kodu
<?php
function multiplication($n)
{
return($n * $n);
}
$tab = array(1,2,3,4);
print_r(array_map("multiplication", $tab));
?>
Çıktı:
PHP- Kodu
Array
(
[0] => 1
[1] => 4
[2] => 9
[3] => 16
)
**************************************************
24. get_class
Bu işlev, verilen nesnenin sınıf adını alır.
PHP- Kodu
<?php
// create an object
$obj = new Foo();
// get the class name
echo get_class($obj);
?>
**************************************************
25. class_exists
Bu işlev, verilen sınıfın tanımlanıp tanımlanmadığını kontrol eder.
PHP- Kodu
<?php
if (class_exists('Foo')) {
$obj = new Foo();
}
?>