Skip to content

Category: Coding

Zend Framework : Sending emails using Zend_Mail and Google Smtp

Sending emails using Zend_Mail component from Zend Framework is an easy as it can get task. On a recent project, i needed to configure Zend_Mail to work with Google Smtp server. Here is a quick how to: $settings = array(’ssl’=>’ssl’, ‘port’=>465, ‘auth’ => ‘login’, ‘username’ => ‘[email protected]’, ‘password’ => ‘YOUR_PASSWORD’);…

Revisiting PHP 5.3 __invoke magic method

PHP version 5.3 introduced a new magic method designed __invoke, this method is called when a script tries to call an object as a function.

The __invoke magic method

< ?php
class Car {
	public function __invoke($v) 
		echo "Just called object as function with parameter '".$v."'\n";
$c	=	new Car;
// Just to make sure we have an object
echo "I am an object of type: ".get_class($c)."\n";
// Now let's use it as a function