0% found this document useful (0 votes)
4 views4 pages

php_prac_9

Uploaded by

saeedarwatkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

php_prac_9

Uploaded by

saeedarwatkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Practical No.

9
1) WAP to implement Introspection methods.
<?php

class Parent_Class

public $name;

public $age;

public function method1(){}

public function method(){}

class Child_Class extends Parent_Class {}

echo"get_class():<br>";

$obj=new Parent_Class();

echo get_class($obj);

echo "<br>";

echo "<br>";

echo"get_parent_class():<br>";

$obj1 =new Child_Class();

echo get_parent_class($obj1);

echo "<br>";

echo "<br>";
echo "get_Class_method:<br>";

print_r(get_class_methods('Parent_Class'));

echo "<br>";

echo "<br>";

echo "method_exists:<br>";

echo method_exists($obj, 'method1')?"Method Exists in Parent_Class...":"Method does not Exists";

echo "<br>";

echo "<br>";

echo "property_exits:<br>";

echo property_exists($obj, 'name')?"Property Exists in Parent_Class...":"Property does not Exists";

echo "<br>";

echo "<br>";

echo "is_a:<br>";

echo is_a($obj,'Child_Class')?"Child_Class inherits Parent_Class...":"Child_Class does not inherit Parent_Class";

echo "<br>";

echo "<br>";

?>
Output:
2) Write a program to implement serialization

<?php

$a = serialize(array("Welcome", "to", "PHP"));

echo "Serialization:<br>";

echo $a . "<br>";

$a_un = unserialize($a);

echo "Unserialization:<br>";

print_r($a_un);

?>

Output:

You might also like