Page 348 - CITS - CSA - TP (Volume 1) - Hindi
P. 348
कंप्यूटर सॉफ्टवेयर एप्लीकेशन- CITS
टा 4: ास और मेथड के ए स की जाँच करना
1 टे एिडटर ओपन कर
2 िन कोड िलख
<html >
<head>
<title> Checking for class and method existence </title>
</head>
<body>
<?php
// Define a class
class MyClass
{
public function myMethod()
{
echo “Hello from myMethod!<br/>”;
}
}
// Check if class exists
if (class_exists(‘MyClass ))
{
echo “MyClass exists. <br/>”;
}
else
{
echo “MyClass does not exist. <br/>”;
}
// Check if method exists in the class
if (method_exists(‘MyClass , ‘myMethod ))
{
echo “myMethod exists in MyClass. <br/>”;
}
else
332
CITS : IT & ITES - कं ूटर सॉ वेयर ए ीके शन - अ ास 60

