Jonathan Reinink Software developer from Canada Been writing PHP for about 15 years Marketing agency for over a decade Started contract development this year Leadership group of The PHP League Wrote the Plates template library Wrote the Glide image library I <3 open source
“This blog post is not for the faint- hearted! Some people will strongly disagree with me and some others will probably want to kill me at the upcoming Zend Conference.” —Fabien Potencier
if ($stmt = $mysqli->prepare("SELECT name FROM friends")) { $stmt->execute(); $stmt->bind_result($name); ! while ($stmt->fetch()) { echo ''.$name.''; } } ?>
class TemplateProxy { protected $value; ! public function __get($name) { return new TemplateProxy($this->name); } ! public function __call($name, $args) { return new TemplateProxy(...); } ! public function __toString() { return $this->escape($this->value); } }
Rule #4: Controllers can instantiate only one object. Therefore, views can only know about one instance variable and views should only send messages to that object. — Sandi Metz, rules for developers