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..............
question 4:
ReplyDeletearray_unshift()
Answer for question 1 = strtok($string, "\t\n");
ReplyDeleteto verify, check:
http://www.php.net/strtok