Thursday, February 21, 2008

php questions

1 Consider the following String:

$string = "John\tMark\nTed\tLarry";

2 Which of the following functions would best parse the string above by the tab (\t) and newline (\n) characters?

3 How can you modify the copy of an object during a clone operation?

Answer...
Put the logic in the object's constructor to alter the values
Implment your own function to do object copying
Implement the object's __clone() method
Implement __get() and __set() methods with the correct logic
Implement the __copy() method with the correct logic

4 Which function would you use to add an element to the beginning of an array?

Answer...
array_shift()
array_push();
$array[0] = "value";
array_unshift()
array_pop();

ans: array_unshift();

Please answer through the comments I will make it publish on blog..............

2 comments:

Please put your comments here. your questions, your suggestions, also what went wrong with me.