Tuesday, 13 June 2023

Advance PHP-Part5

 

Q4) Attempt any four of the following : [4 × 4 = 16]

1)What is Inheritance? Explain with suitable example.

o    It is a concept of accessing the features of one class from another class. If we inherit the class features into another class, we can access both class properties. We can extends the features of a class by using 'extends' keyword.

o    It supports the concept of hierarchical classification.

o    Inheritance has three types, single, multiple and multilevel Inheritance.

o    PHP supports only single inheritance, where only one class can be derived from single parent class.

o    We can simulate multiple inheritance by using interfaces.

<?php  

class a  

    {  

        function fun1()  

        {  

            echo "javatpoint";  

        }  

    }  

    class b extends a  

    {  

        function fun2()  

        {  

            echo "SSSIT";  

        }  

    }  

    $obj= new b();  

    $obj->fun1();  

?>  

 

2) Create a XML file which gives details of books availabel in "ABC Bookstore" from following. Categories i) Technical ii) Cooking iii) YOGA

https://bcapractical2017.blogspot.com/2017/12/awt-slip18.html

 

3) Define class Employee having private members id, name department, Salary. Define parameterized constructor. Create a Subclass called "Manager" with private member bonus. Create 6 objects of the Manager class and display the details of the Manager having the maximum total salary. (Salary + bonus)

https://bcapractical2017.blogspot.com/2017/12/awt-slip5.html

 

4) Explain setting  Response Headers.

 

The superglobal $http_response_header array is populated by HTTP response headers as is the case with get_headers() functions. This array is created in local space of PHP

<?php
file_get_contents("http://localhost");
$arr=$http_response_header;
foreach ($arr as $key=>$val)
echo "<p>$key=>$val </p>";
?>

 

5) Explain the structure of WSDL.

 

Element

Description

<types>

Defines the (XML Schema) data types used by the web service

<message>

Defines the data elements for each operation

<portType>

Describes the operations that can be performed and the messages involved.

<binding>

Defines the protocol and data format for each port type

The main structure of a WSDL document looks like this:

<definitions>

<types>
  data type definitions........
</types>

<message>
  definition of the data being communicated....
</message>

<portType>
  set of operations......
</portType>

<binding>
  protocol and data format specification....
</binding>

</definitions>

WSDL Example

This is a simplified fraction of a WSDL document:

<message name="getTermRequest">
  <part name="term" type="xs:string"/>
</message>

<message name="getTermResponse">
  <part name="value" type="xs:string"/>
</message>

<portType name="glossaryTerms">
  <operation name="getTerm">
    <input message="getTermRequest"/>
    <output message="getTermResponse"/>
  </operation>
</portType>

 

 

6) What are the advantages of AJAX?

 

Ajax is a set of web development techniques using many web technologies on the client-side to create asynchronous web applications. With Ajax, web applications can send and retrieve data from a server asynchronously without interfering with the display and behavior of the existing page.

Any other technology Ajax also has its own pros and cons. Let's look at some of those.

Pros −

·         Allows applications to render without data and fill data as the application gets it from the server.

·         Gives platform independence to application developers

·         Faster page renders

·         More responsive applications

·         No rerenders of whole pages are needed to update only a single area.

Cons

·         Any user whose browser does not support JavaScript or XMLHttpRequest, or has this functionality disabled, will not be able to properly use pages that depend on Ajax.

·         Multiple server requests need more data consumed at the client-side.

·         Failure of any one request can fail the load of the whole page.

·         Browsers with JS disabled will not be able to use pages using ajax.

 

 

 

7) Write a PHP Script to read book. XML and print book details in tabular format using simple XML. (Content of book. XML are (bookcode, bookname, author, year, price).

 

https://bcapractical2017.blogspot.com/2017/12/awt-slip18.html

                                                                                                                                            

 

8) Write PHP script to demonstrate the concept of introspection for examining object.

https://bcapractical2017.blogspot.com/2017/12/awt-slip3.html

 

9)Create student table as follows : Student (Sno, Sname, Per). Write Ajax program to select the student name and print the selected student’s details.

 

https://bcapractical2017.blogspot.com/2017/12/awt-slip12.html

 

10)Write Ajax Program to Print Movie details by selecting and Actor’s name. Create table MOVIE and ACTOR as follows with 1:M cardinality. MOVIE (mno, mname, release_) and ACTOR (ano, aname)

 

https://bcapractical2017.blogspot.com/2022/05/advance-php-slip21b-write-ajax-program.html