Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

wwwxxxAPC, How to unsubscrube from dategen spam, WWWXXXAPC, docmd.close 2585, WWWXXXDOCO, nu vot, dhcpd lease file "binding state", WWWXXXDOCO, how to setup procmail to process html2text, how to setup procmail html2text



#1: Tough questions

Posted on 2008-04-24 21:37:57 by UKuser

Studying away for the Zend exam ( and 2 questions
have come up in the mocks which are confusing:

1) The __________ interface implements a useful design pattern which
allows you to overload an instance of an object so it can be accessed
like an array
[Confusion here - because of the overloading - is the answer simply

2) The following PHP script is an example of which design pattern?


interface HashAlgorithm {
public function hash($value);

class MyClass {

private $value;

public function __construct($value) {
$this->value = $value;

public function hash(HashAlgorithm $a) {
return $a->hash($this->value);

class MD5Hash implements HashAlgorithm {
public function hash($value) {
return md5($hash);

$obj = new MyClass("John");
$obj->hash(new MD5Hash());

What pattern is this? I've looked through the regulars and not using
patterns regularly - can't see which it is.

A general Q - why is MVC so good? I understand it to be index.php?
page_to_redirect - with just it routing people to various pages. Why
is this such a good idea? I don't see a) how this separates business
logic and b) where the advantages come for say a single designer/
administrated site? To separate business logic - why couldn't I just
use a simple templating system? Maybe its a dumb question.

Thanks in advance.


Report this message