interface_exists() ফাংশনটি চেক করে ইন্টারফেস ডিফাইন করা হয়েছে কিনা। name_of_interface দিয়ে দেওয়া ইন্টারফেস ডিফাইন করা থাকলে TRUE, অন্যথায় FALSE রিটার্ন করে।
সিনট্যাক্স
interface_exists(name_of_interface, autoload)
প্যারামিটার
name_of_interface − ইন্টারফেসের নাম।
autoload − ডিফল্টভাবে __autoload কল করা হবে কিনা।
রিটার্ন
interface_exists() ফাংশনটি name_of_interface দিয়ে দেওয়া ইন্টারফেস ডিফাইন করা থাকলে TRUE রিটার্ন করে। অন্যথায় FALSE রিটার্ন করে।
উদাহরণ
নিচে একটি উদাহরণ দেওয়া হলো −
<?php
if (interface_exists('DemoInterface')) {
class MyClass implements DemoInterface {
// Methods
}
}
?>