[qdeck]
[q] Is multiple inheritance supported in PHP?
[a] PHP supports only single inheritance; it means that a class can be extended from only one single class using the keyword ‘extended’.
[q] What is the meaning of a final class and a final method?
[a] ‘final’ is introduced in PHP5. Final class means that this class cannot be extended and a final method cannot be overridden.
[q] How is the comparison of objects done in PHP?
[a] We use the operator ‘==’ to test is two objects are instanced from the same class and have same attributes and equal values. We can test if two objects are referring to the same instance of the same class by the use of the identity operator ‘===’.
[q] How can PHP and HTML interact?
[a] It is possible to generate HTML through PHP scripts, and it is possible to pass pieces of information from HTML to PHP.
[q] Types of Arrays
[a] Numeric/Indexed Array
[q] Associative array
[a] An array with strings as an index. This stores element values in association with key values rather than in a strict linear index order.
[q] Multidimensional array
[a] An array containing one or more arrays and values are accessed using multiple indices.
[q] What Kind of array is this?
<?php $fruit = array(“Mango”, “Papaya”, “Orange”); echo “I would like to eat “ . $fruit[0] . “, “ . $fruit[1] . ” and “ . $fruit[2] . “.”; ?>
[a] Numeric/Indexed Array
An indexed or numeric array stores each array element with a numeric index.
[q] What Kind of Array is this?
<?php $age = array(“Symntha”=>“15”, “Clan”=>“17”, “Smith”=>“23”); echo “Symntha is “ . $age[‘Symntha’] . ” years old.”; ?>
[a] Associative Arrays
The associative arrays are very similar to numeric arrays in term of functionality but they are different in terms of their index. Associative array will have their index as string so that you can establish a strong association between key and values.
[q] What kind of array is this?
<?php $cars = array ( array(“Elentra”,22,18), array(“Audi”,15,13), ); echo $cars[0][0].“: In stock: “.$cars[0][1].“, sold: “.$cars[0][2].“.\n”; echo “<br>”; echo $cars[1][0].“: In stock: “.$cars[1][1].“, sold: “.$cars[1][2].“.\n”; ?>
[a] Multi-dimensional Array
A multi-dimensional array each element in the main array can also be an array. And each element in the sub-array can be an array, and so on. Values in the multi-dimensional array are accessed using multiple index.
[/qdeck]