<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Human Interest &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/human-interest/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>The Better Way to Unset Variables in PHP</title>
		<link>/2010/09/03/the-better-way-to-unset-variables-in-php/</link>
		<comments>/2010/09/03/the-better-way-to-unset-variables-in-php/#respond</comments>
		<pubDate>Fri, 03 Sep 2010 09:42:31 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[Parameter]]></category>
		<category><![CDATA[php functions]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[php tricks]]></category>
		<category><![CDATA[Scripting languages]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Unset]]></category>
		<category><![CDATA[unset in php]]></category>

		<guid isPermaLink="false">/?p=1953</guid>
		<description><![CDATA[Don&#8217;t know why, but most of times I see the PHP unset() multilined with a only one parameter!? unset($var1); unset($var2); unset($var3); But as you can see from the PHP doc page of unset() this method takes optional parameter count. void unset(mixed $var [, mixed $var [, mixed $...]]) So perhaps a better solution can be: &#8230; <a href="/2010/09/03/the-better-way-to-unset-variables-in-php/" class="more-link">Continue reading <span class="screen-reader-text">The Better Way to Unset Variables in PHP</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/06/11/friday-algorithms-quicksort-difference-between-php-and-javascript/" rel="bookmark" title="Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript">Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript </a></li>
<li><a href="/2010/05/19/php-associative-arrays-coding-style/" rel="bookmark" title="PHP Associative Arrays Coding Style">PHP Associative Arrays Coding Style </a></li>
<li><a href="/2011/10/19/thing-to-know-about-php-arrays/" rel="bookmark" title="Thing to Know About PHP Arrays">Thing to Know About PHP Arrays </a></li>
<li><a href="/2011/10/27/object-cloning-and-passing-by-reference-in-php/" rel="bookmark" title="Object Cloning and Passing by Reference in PHP">Object Cloning and Passing by Reference in PHP </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Don&#8217;t know why, but most of times I see the PHP unset() multilined with a only one parameter!?</p>
<pre lang="php">unset($var1);
unset($var2);
unset($var3);
</pre>
<p>But as you can see from the PHP <a title="doc page of unset()" href="http://php.net/manual/en/function.unset.php" target="_blank">doc page of unset()</a> this method takes optional parameter count.</p>
<pre lang="php">void unset(mixed $var [, mixed $var [, mixed $...]])
</pre>
<p>So perhaps a better solution can be:</p>
<pre lang="php">unset($var1, $var2, $var3);
</pre>
<p>It&#8217;s at least single lined!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/06/11/friday-algorithms-quicksort-difference-between-php-and-javascript/" rel="bookmark" title="Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript">Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript </a></li>
<li><a href="/2010/05/19/php-associative-arrays-coding-style/" rel="bookmark" title="PHP Associative Arrays Coding Style">PHP Associative Arrays Coding Style </a></li>
<li><a href="/2011/10/19/thing-to-know-about-php-arrays/" rel="bookmark" title="Thing to Know About PHP Arrays">Thing to Know About PHP Arrays </a></li>
<li><a href="/2011/10/27/object-cloning-and-passing-by-reference-in-php/" rel="bookmark" title="Object Cloning and Passing by Reference in PHP">Object Cloning and Passing by Reference in PHP </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/09/03/the-better-way-to-unset-variables-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Which Model Should Contain That Method?</title>
		<link>/2010/07/28/which-model-should-contain-that-method/</link>
		<comments>/2010/07/28/which-model-should-contain-that-method/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 15:07:41 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Business/Finance]]></category>
		<category><![CDATA[Computer science]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Data management]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database management systems]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[From]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[IBM software]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL keywords]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">/?p=1866</guid>
		<description><![CDATA[Let&#8217;s say you have two models &#8211; each one modeling a database table &#8211; Users &#38; Article. Here there&#8217;s nothing to deal with Zend Framwork, but you can think of them as typical models in a ZF application. What happens if you have to write a getUserArticles method? Where would you put it? Whether this &#8230; <a href="/2010/07/28/which-model-should-contain-that-method/" class="more-link">Continue reading <span class="screen-reader-text">Which Model Should Contain That Method?</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/07/12/mvc-in-practice-designing-models/" rel="bookmark" title="MVC in Practice: Designing Models">MVC in Practice: Designing Models </a></li>
<li><a href="/2010/07/19/zend-framework-cache-database-table-schemes/" rel="bookmark" title="Zend Framework: Cache Database Table Schemes">Zend Framework: Cache Database Table Schemes </a></li>
<li><a href="/2010/08/05/fetching-rows-with-zend_db-fetch/" rel="bookmark" title="Fetching Rows With Zend_Db fetch()">Fetching Rows With Zend_Db fetch() </a></li>
<li><a href="/2010/04/26/mysql-expressions-in-zend-framework/" rel="bookmark" title="MySQL Expressions in Zend Framework">MySQL Expressions in Zend Framework </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Let&#8217;s say you have two models &#8211; each one modeling a database table &#8211; <strong>Users</strong> &amp; <strong>Article</strong>. Here there&#8217;s nothing to deal with Zend Framwork, but you can think of them as typical models in a ZF application.</p>
<p>What happens if you have to write a getUserArticles method? Where would you put it? Whether this will be the User model or the Article model?<a href="/wp-content/uploads/2010/07/question.jpg"><img class="aligncenter size-full  wp-image-1875" title="question" src="/wp-content/uploads/2010/07/question.jpg" alt="Where?" width="430" height="231" srcset="/wp-content/uploads/2010/07/question.jpg 430w, /wp-content/uploads/2010/07/question-300x161.jpg 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<p>Although technically you can put it in both models my advice is to look at the SQL query. If the FROM clause is containing the user table &#8211; than put the method in the User model, but here you&#8217;d have something like:</p>
<pre lang="sql">
SELECT * FROM Article WHERE user_id = 1
</pre>
<p>I&#8217;d prefer to place it in the Article model!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/07/12/mvc-in-practice-designing-models/" rel="bookmark" title="MVC in Practice: Designing Models">MVC in Practice: Designing Models </a></li>
<li><a href="/2010/07/19/zend-framework-cache-database-table-schemes/" rel="bookmark" title="Zend Framework: Cache Database Table Schemes">Zend Framework: Cache Database Table Schemes </a></li>
<li><a href="/2010/08/05/fetching-rows-with-zend_db-fetch/" rel="bookmark" title="Fetching Rows With Zend_Db fetch()">Fetching Rows With Zend_Db fetch() </a></li>
<li><a href="/2010/04/26/mysql-expressions-in-zend-framework/" rel="bookmark" title="MySQL Expressions in Zend Framework">MySQL Expressions in Zend Framework </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/07/28/which-model-should-contain-that-method/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting Up Global Cache in Zend Framework</title>
		<link>/2010/07/21/setting-up-global-cache-in-zend-framework/</link>
		<comments>/2010/07/21/setting-up-global-cache-in-zend-framework/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 11:17:48 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[Front Controller pattern]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[large scale web application]]></category>
		<category><![CDATA[PHP For Applications]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Software framework]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Zend Technologies]]></category>

		<guid isPermaLink="false">/?p=1830</guid>
		<description><![CDATA[In a large scale web application, especially based on Zend Framework, there are lot&#8217;s of components that support built in cache support. Such are Zend_Db, Zend_Translate, Zend_Date, etc. Also you may need cache support wherever in the app, so my advice is to setup a cache instance in the &#8220;beginning&#8221;, into the bootstrap.php or even &#8230; <a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" class="more-link">Continue reading <span class="screen-reader-text">Setting Up Global Cache in Zend Framework</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/07/19/zend-framework-cache-database-table-schemes/" rel="bookmark" title="Zend Framework: Cache Database Table Schemes">Zend Framework: Cache Database Table Schemes </a></li>
<li><a href="/2010/08/06/setting-up-zend-framework-with-modules/" rel="bookmark" title="Setting Up Zend Framework with Modules">Setting Up Zend Framework with Modules </a></li>
<li><a href="/2010/01/27/theory-of-caching-zend_cache-zend-optimizer/" rel="bookmark" title="Theory of caching. Zend_Cache &#038; Zend Optimizer.">Theory of caching. Zend_Cache &#038; Zend Optimizer. </a></li>
<li><a href="/2010/08/09/models-in-zend-framework-initialize-all-methods-with-init/" rel="bookmark" title="Models in Zend Framework &#8211; Initialize All Methods with init()">Models in Zend Framework &#8211; Initialize All Methods with init() </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>In a large scale web application, especially based on Zend Framework, there are lot&#8217;s of components that support built in cache support. Such are <a href="http://framework.zend.com/manual/en/zend.db.html">Zend_Db</a>, <a href="http://zendframework.com/manual/en/zend.translate.html">Zend_Translate</a>, <a href="http://framework.zend.com/manual/en/zend.date.html">Zend_Date</a>, etc. Also you may need cache support wherever in the app, so my advice is to setup a cache instance in the &#8220;beginning&#8221;, into the bootstrap.php or even better &#8211; into a front controller plugin, and to store it into the Zend_Registry. Thus you&#8217;ve to change only the lifetime for specific needs:</p>
<pre lang="php">
<?php

class CacheInit extends Zend_Controller_Plugin_Abstract
{
    public function __construct()
    {
        $frontendOptions = array(
            'automatic_serialization' => true,
            'lifetime' => 60
        );

        $backendOptions  = array(
            'cache_dir' => realpath(APPLICATION_PATH . '/../cache')
        );

        $cache = Zend_Cache::factory('Core',
                                     'File',
                                     $frontendOptions,
                                     $backendOptions);

        Zend_Registry::set('cache', $cache);
    }
}
</pre>
<p>Than add it as a front controller plugin:</p>
<pre lang="php">
// cache plugin
$frontController->registerPlugin(new CacheInit());
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/07/19/zend-framework-cache-database-table-schemes/" rel="bookmark" title="Zend Framework: Cache Database Table Schemes">Zend Framework: Cache Database Table Schemes </a></li>
<li><a href="/2010/08/06/setting-up-zend-framework-with-modules/" rel="bookmark" title="Setting Up Zend Framework with Modules">Setting Up Zend Framework with Modules </a></li>
<li><a href="/2010/01/27/theory-of-caching-zend_cache-zend-optimizer/" rel="bookmark" title="Theory of caching. Zend_Cache &#038; Zend Optimizer.">Theory of caching. Zend_Cache &#038; Zend Optimizer. </a></li>
<li><a href="/2010/08/09/models-in-zend-framework-initialize-all-methods-with-init/" rel="bookmark" title="Models in Zend Framework &#8211; Initialize All Methods with init()">Models in Zend Framework &#8211; Initialize All Methods with init() </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/07/21/setting-up-global-cache-in-zend-framework/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Zend_Mail with GMail</title>
		<link>/2010/07/18/zend_mail-with-gmail/</link>
		<comments>/2010/07/18/zend_mail-with-gmail/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 11:39:20 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computer-mediated communication]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Cross-platform software]]></category>
		<category><![CDATA[E-mail]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[Gmail interface]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[Simple Mail Transfer Protocol]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[World Wide Web]]></category>

		<guid isPermaLink="false">/?p=1817</guid>
		<description><![CDATA[You know how to setup Zend_Mail with SMTP, but you don&#8217;t know how to set it up with GMail! Here&#8217;s how to do it. Just follow the instructions 😉 $mailTransport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', array( 'auth' => 'login', 'username' => 'xxxxxx@gmail.com', 'password' => 'passxxxxx', 'port' => '587', 'ssl' => 'tls', )); Zend_Mail::setDefaultTransport($mailTransport);<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/03/25/send-mail-with-zend-framework/" rel="bookmark" title="Send Mail with Zend Framework">Send Mail with Zend Framework </a></li>
<li><a href="/2010/07/17/send-html-mails-with-zend_mail/" rel="bookmark" title="Send Html Mails with Zend_Mail">Send Html Mails with Zend_Mail </a></li>
<li><a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" rel="bookmark" title="Send Authenticated POST Request with Zend_Http_Client">Send Authenticated POST Request with Zend_Http_Client </a></li>
<li><a href="/2010/07/20/zend-framework-connect-mysql/" rel="bookmark" title="Zend Framework: Connect MySQL">Zend Framework: Connect MySQL </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p><a href="/wp-content/uploads/2010/07/zend_mail_gmail.jpg"><img src="/wp-content/uploads/2010/07/zend_mail_gmail.jpg" alt="Zend_Mail and GMail" title="zend_mail_gmail" width="250" height="370" class="aligncenter size-full wp-image-1821" srcset="/wp-content/uploads/2010/07/zend_mail_gmail.jpg 250w, /wp-content/uploads/2010/07/zend_mail_gmail-202x300.jpg 202w" sizes="(max-width: 250px) 100vw, 250px" /></a><br />
You know how to setup Zend_Mail with SMTP, but you don&#8217;t know how to set it up with GMail! Here&#8217;s how to do it. Just follow the instructions <img src="https://s.w.org/images/core/emoji/11/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<pre lang="php">
$mailTransport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', array(
    'auth'     => 'login',
    'username' => 'xxxxxx@gmail.com',
    'password' => 'passxxxxx',
    'port'     => '587',
    'ssl'      => 'tls',
));
Zend_Mail::setDefaultTransport($mailTransport);
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/03/25/send-mail-with-zend-framework/" rel="bookmark" title="Send Mail with Zend Framework">Send Mail with Zend Framework </a></li>
<li><a href="/2010/07/17/send-html-mails-with-zend_mail/" rel="bookmark" title="Send Html Mails with Zend_Mail">Send Html Mails with Zend_Mail </a></li>
<li><a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" rel="bookmark" title="Send Authenticated POST Request with Zend_Http_Client">Send Authenticated POST Request with Zend_Http_Client </a></li>
<li><a href="/2010/07/20/zend-framework-connect-mysql/" rel="bookmark" title="Zend Framework: Connect MySQL">Zend Framework: Connect MySQL </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/07/18/zend_mail-with-gmail/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Four Things to Know when Writing Comments</title>
		<link>/2010/06/27/four-things-to-know-when-writing-comments/</link>
		<comments>/2010/06/27/four-things-to-know-when-writing-comments/#comments</comments>
		<pubDate>Sun, 27 Jun 2010 09:52:39 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Comment]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[Logic]]></category>
		<category><![CDATA[Metadata]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[Source lines of code]]></category>
		<category><![CDATA[speaker]]></category>

		<guid isPermaLink="false">/?p=1668</guid>
		<description><![CDATA[Every developer has been learned from his teachers how important is to comment his source code. You should comment the classes, the methods, the logic, etc. However nobody explained how exactly to code with comments between the lines. Have you ever seen that i++; // we increment i with one That&#8217;s a shame! This doesn&#8217;t &#8230; <a href="/2010/06/27/four-things-to-know-when-writing-comments/" class="more-link">Continue reading <span class="screen-reader-text">Four Things to Know when Writing Comments</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/05/24/javascript-objects-coding-style/" rel="bookmark" title="JavaScript Objects Coding Style">JavaScript Objects Coding Style </a></li>
<li><a href="/2010/06/11/friday-algorithms-quicksort-difference-between-php-and-javascript/" rel="bookmark" title="Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript">Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript </a></li>
<li><a href="/2010/07/12/mvc-in-practice-designing-models/" rel="bookmark" title="MVC in Practice: Designing Models">MVC in Practice: Designing Models </a></li>
<li><a href="/2010/01/09/array-hint-in-javascript/" rel="bookmark" title="Array hint in JavaScript">Array hint in JavaScript </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p><a href="/wp-content/uploads/2010/06/how-to-write-comments.jpg"><img src="/wp-content/uploads/2010/06/how-to-write-comments.jpg" alt="How to write comments" title="how-to-write-comments" width="250" height="241" class="aligncenter size-full wp-image-1710" /></a><br />
Every developer has been learned from his teachers how important is to comment his source code. You should comment the classes, the methods, the logic, etc. However nobody explained how exactly to code with comments between the lines. Have you ever seen that</p>
<h2>i++; // we increment i with one</h2>
<p>That&#8217;s a shame! This doesn&#8217;t tell you anything, and what will happen if sometime later somebody sits in front of that code? He&#8217;d be amazed!</p>
<h2>How To</h2>
<p>In fact the task is not to determine what are the bad parts of not commenting the code, but how to overcome this. How to write comments. Here are some basic advices.</p>
<h3>1. Think about the other developers</h3>
<p>First of all the most important thing is to write comments with other programmers in mind. They should understand the logic of your code from your comments and not from the code itself.</p>
<h3>2. Write in English</h3>
<p>Even you&#8217;re not a native English speaker, and you English is not so good, it&#8217;s a must to write in English. This is really important when you work for a open source project when always there&#8217;s a big community around the project, you cannot be sure that everybody understands your language.</p>
<p>I know that this is difficult &#8211; also for me the English is not my native language, but that&#8217;s really a must. Once you start doing it, you&#8217;ll see that it&#8217;s not so difficult.</p>
<h3>3. Comment the methods as a black box</h3>
<p>Don&#8217;t write in a method comment what technique is used to achieve the result. It&#8217;s good to describe what the method does, not how it does it.</p>
<p>Bad example:</p>
<pre lang="php">
/**
 * returns $a + $b
 */
public function sum($a, $b) 
{
    return $a + $b;
}
</pre>
<p>Better:</p>
<pre lang="php">
/**
 * Returns the sum of two numbers
 * 
 * @param number $a
 * @param number $b
 * @returns number $a + $b
 */
public function sum($a, $b)
{
    return $a + $b;
}
</pre>
<h3>4. Comment the logic, not the technical solution</h3>
<p>When there&#8217;s a loop or a statement it&#8217;s useless to describe that this is a loop or statement, isn&#8217;t it? A better approach is to describe in a comment why you needed to implement this logic in such way.</p>
<p>Wrong:</p>
<pre lang="php">
...
$arr = array();
$i = 0;

// in a while loop we
// initialize every element with 0
while ($i < 100) {
    $arr[$i++] = 0; 
}
...
</pre>
<p>Better:</p>
<pre lang="php">
...
$arr = array();
$i = 0;

// we initialize an array of 0s
// to store the sorted elements
// on the first pass... etc, etc.
while ($i < 100) {
    $arr[$i++] = 0; 
}
...
</pre>
<h2>Conclusion</h2>
<p>In fact the most important thing is to write comments with other developers in mind. Tell the future developer of that code what's in the code, and pray for mercy <img src="https://s.w.org/images/core/emoji/11/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/05/24/javascript-objects-coding-style/" rel="bookmark" title="JavaScript Objects Coding Style">JavaScript Objects Coding Style </a></li>
<li><a href="/2010/06/11/friday-algorithms-quicksort-difference-between-php-and-javascript/" rel="bookmark" title="Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript">Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript </a></li>
<li><a href="/2010/07/12/mvc-in-practice-designing-models/" rel="bookmark" title="MVC in Practice: Designing Models">MVC in Practice: Designing Models </a></li>
<li><a href="/2010/01/09/array-hint-in-javascript/" rel="bookmark" title="Array hint in JavaScript">Array hint in JavaScript </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/06/27/four-things-to-know-when-writing-comments/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Use Zend_Translate to Translate Your Web App</title>
		<link>/2010/06/15/use-zend_translate-to-translate-your-web-app/</link>
		<comments>/2010/06/15/use-zend_translate-to-translate-your-web-app/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 17:38:39 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Configuration files]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[INI file]]></category>
		<category><![CDATA[large scale systems]]></category>
		<category><![CDATA[large web system]]></category>
		<category><![CDATA[multilingual site]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[System software]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">/?p=1614</guid>
		<description><![CDATA[There are some really good reasons to use Zend_Translate for your multilingual site instead of some other technique. Actually you can definitely simulate something like this Zend component with and array or ini file, but here are some good things to mention. 1. Write a human readable source file In fact you can do this &#8230; <a href="/2010/06/15/use-zend_translate-to-translate-your-web-app/" class="more-link">Continue reading <span class="screen-reader-text">Use Zend_Translate to Translate Your Web App</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2009/05/10/phpini-for-two-web-servers/" rel="bookmark" title="php.ini for two web servers">php.ini for two web servers </a></li>
<li><a href="/2011/01/17/a-memcached-zend_cache/" rel="bookmark" title="A Memcached Zend_Cache">A Memcached Zend_Cache </a></li>
<li><a href="/2010/03/02/fast-way-to-manage-the-arabic-version-of-a-web-form/" rel="bookmark" title="Fast way to manage the Arabic version of a web form">Fast way to manage the Arabic version of a web form </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>There are some really good reasons to use <a title="Zend_Translate" href="http://framework.zend.com/manual/en/zend.translate.html" target="_blank">Zend_Translate</a> for your multilingual site instead of some other technique. Actually you can definitely simulate something like this Zend component with and array or ini file, but here are some good things to mention.</p>
<h2>1. Write a human readable source file</h2>
<p>In fact you can do this even without Zend_Translate. Image you&#8217;ve an ini file with some pairs like:</p>
<pre>
lblMyLabel = "My Label"
</pre>
<p>Nobody says this cannot be &#8220;more&#8221; human readable &#8211; like so:</p>
<pre>
My Label = "My Label"
</pre>
<p>Than you can support several files i.e. en.ini, de.ini, etc. where you can translate this label. The problem is that once you read the ini file you&#8217;ve to deal with those white spaces into the labels, while with Zend_Translate you can simply call them with:</p>
<pre lang="php">
$translate->_("My Label");
</pre>
<h2>2. Default values for missing labels</h2>
<p>Zend_Translate forces you to define a source file. Which is really great, because you always have a default value. Assuming that you don&#8217;t have a specific label translated in one of the ini files, you&#8217;ll get the default value from the source file, and defining source and other files is as easy as:</p>
<pre lang="php">
// en.ini
My Label = "My Label"

// de.ini
...

// while the locale is de_DE you'll have 
// the default value returned
$translate->_("My Label"); // will return My Label from the en.ini
</pre>
<h2>3. Locales</h2>
<p>It&#8217;s really great that you can directly setup a locale for this module. Thus you have more flexibility when switching between languages and you can benefit from the power of the framework when reading some browser specific locales. Here&#8217;s some code:</p>
<pre lang="php">
$translate = new Zend_Translate('ini', 'en.ini', 'en');
$translate->addTranslation('de.ini', 'de');

// than when you setup the translation locale
$translate->setLocale('en');
</pre>
<h2>4. Cache</h2>
<p>One of the greatest things about Zend_Translate is the native support of cache. It&#8217;s so cool! Actually the labels of a large web system are pretty static and don&#8217;t change every day. In other hand in large scale systems there are lots of labels, and the load time will be faster with cache.</p>
<pre lang="php">
$frontendOptions = array('lifetime' => 600, 'automatic_serialization' => true);
$backendOptions  = array('cache_dir' => 'path_to_cache_dir');

$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);

Zend_Translate::setCache($cache);
</pre>
<p>It&#8217;s a great advantage to use Zend_Translate after all this. Actually I have finished projects without any use of it, but I really can&#8217;t imagine how I&#8217;ll work now without it!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2009/05/10/phpini-for-two-web-servers/" rel="bookmark" title="php.ini for two web servers">php.ini for two web servers </a></li>
<li><a href="/2011/01/17/a-memcached-zend_cache/" rel="bookmark" title="A Memcached Zend_Cache">A Memcached Zend_Cache </a></li>
<li><a href="/2010/03/02/fast-way-to-manage-the-arabic-version-of-a-web-form/" rel="bookmark" title="Fast way to manage the Arabic version of a web form">Fast way to manage the Arabic version of a web form </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/06/15/use-zend_translate-to-translate-your-web-app/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JSON and Zend Framework? &#8211; Zend_Json</title>
		<link>/2010/06/10/json-and-zend-framework-zend_json/</link>
		<comments>/2010/06/10/json-and-zend-framework-zend_json/#respond</comments>
		<pubDate>Thu, 10 Jun 2010 14:08:59 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Curly bracket programming languages]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[Procedural programming languages]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Web application frameworks]]></category>
		<category><![CDATA[Whitespace]]></category>

		<guid isPermaLink="false">/?p=1603</guid>
		<description><![CDATA[That&#8217;s really a good Zend Framework&#8217;s class that help you do the encode/decode job very easily. First of all it escapes everything for you and second it prints a correct/valid code. Note that sometimes if you have a trailing whitespace after the closing PHP tag &#8211; ?&#62; that will result in an error. Here&#8217;s some &#8230; <a href="/2010/06/10/json-and-zend-framework-zend_json/" class="more-link">Continue reading <span class="screen-reader-text">JSON and Zend Framework? &#8211; Zend_Json</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/08/13/returning-json-in-a-zend-controllers-action/" rel="bookmark" title="Returning JSON in a Zend Controller&#8217;s Action">Returning JSON in a Zend Controller&#8217;s Action </a></li>
<li><a href="/2010/07/07/default-error-handling-in-zend-framework/" rel="bookmark" title="Default Error Handling in Zend Framework">Default Error Handling in Zend Framework </a></li>
<li><a href="/2010/07/06/zend-framework-simple-acl-front-controller-plugin/" rel="bookmark" title="Zend Framework: Simple Acl Front Controller Plugin">Zend Framework: Simple Acl Front Controller Plugin </a></li>
<li><a href="/2010/04/09/secure-forms-with-zend-framework/" rel="bookmark" title="Secure Forms with Zend Framework">Secure Forms with Zend Framework </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>That&#8217;s really a good Zend Framework&#8217;s class that help you do the encode/decode job very easily. First of all it escapes everything for you and second it prints a correct/valid code. Note that sometimes if you have a trailing whitespace after the closing PHP tag &#8211; ?&gt; that will result in an error.</p>
<p>Here&#8217;s some code:</p>
<pre lang="php">
public function jsonAction()
{
	$data = array(3,4,'test', 'my-name' => 3,4);

	echo Zend_Json::encode($data);

	$this->_helper->viewRenderer->setNoRender(true);
	$this->view->layout()->disableLayout();
}
</pre>
<p>and the result is:</p>
<pre lang="html4strict">
{"0":3,"1":4,"2":"test","my-name":3,"3":4}
</pre>
<p>Note that all integers are printed without double quotes &#8211; which saves some space!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/08/13/returning-json-in-a-zend-controllers-action/" rel="bookmark" title="Returning JSON in a Zend Controller&#8217;s Action">Returning JSON in a Zend Controller&#8217;s Action </a></li>
<li><a href="/2010/07/07/default-error-handling-in-zend-framework/" rel="bookmark" title="Default Error Handling in Zend Framework">Default Error Handling in Zend Framework </a></li>
<li><a href="/2010/07/06/zend-framework-simple-acl-front-controller-plugin/" rel="bookmark" title="Zend Framework: Simple Acl Front Controller Plugin">Zend Framework: Simple Acl Front Controller Plugin </a></li>
<li><a href="/2010/04/09/secure-forms-with-zend-framework/" rel="bookmark" title="Secure Forms with Zend Framework">Secure Forms with Zend Framework </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/06/10/json-and-zend-framework-zend_json/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detecting Pressed Key with e.which in JavaScript</title>
		<link>/2010/06/02/detecting-pressed-key-with-e-which-in-javascript/</link>
		<comments>/2010/06/02/detecting-pressed-key-with-e-which-in-javascript/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 18:48:44 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Form]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[JavaScript programming language]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Software engineering]]></category>

		<guid isPermaLink="false">/?p=1580</guid>
		<description><![CDATA[You have definitely decided to get which key has been pressed with JavaScript? This is very common when it comes to an Enter key press over a form element. Actually this should be automatically done by the browser, but when it comes to a default prevented form you&#8217;ve to check it for yourself. The job &#8230; <a href="/2010/06/02/detecting-pressed-key-with-e-which-in-javascript/" class="more-link">Continue reading <span class="screen-reader-text">Detecting Pressed Key with e.which in JavaScript</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/08/11/quick-look-at-javascript-objects/" rel="bookmark" title="Quick Look at JavaScript Objects">Quick Look at JavaScript Objects </a></li>
<li><a href="/2012/01/24/javascript-performance-for-vs-while/" rel="bookmark" title="JavaScript Performance: for vs. while">JavaScript Performance: for vs. while </a></li>
<li><a href="/2010/02/12/how-to-detect-a-variable-existence-in-javascript/" rel="bookmark" title="How to detect a variable existence in JavaScript?">How to detect a variable existence in JavaScript? </a></li>
<li><a href="/2010/05/24/javascript-objects-coding-style/" rel="bookmark" title="JavaScript Objects Coding Style">JavaScript Objects Coding Style </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>You have definitely decided to get which key has been pressed with JavaScript? This is very common when it comes to an Enter key press over a form element. Actually this should be automatically done by the browser, but when it comes to a default prevented form you&#8217;ve to check it for yourself.</p>
<p>The job can be done with a event&#8217;s which check. Let me show you some JavaScript/jQuery code:</p>
<pre lang="javascript">
$('.selector').click(function(e) {
	console.log(e.which);	
});
</pre>
<p>Note that this can be checked under Firefox and/or Safari like browsers which support the console object. This will give you the idea which key is pressed in a number value. The Enter is usually 13!<br />
If you don&#8217;t have such browser, you can replace that code with something like:</p>
<pre lang="javascript">
$('.selector').click(function(e) {
	alert(e.which);	
});
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/08/11/quick-look-at-javascript-objects/" rel="bookmark" title="Quick Look at JavaScript Objects">Quick Look at JavaScript Objects </a></li>
<li><a href="/2012/01/24/javascript-performance-for-vs-while/" rel="bookmark" title="JavaScript Performance: for vs. while">JavaScript Performance: for vs. while </a></li>
<li><a href="/2010/02/12/how-to-detect-a-variable-existence-in-javascript/" rel="bookmark" title="How to detect a variable existence in JavaScript?">How to detect a variable existence in JavaScript? </a></li>
<li><a href="/2010/05/24/javascript-objects-coding-style/" rel="bookmark" title="JavaScript Objects Coding Style">JavaScript Objects Coding Style </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/06/02/detecting-pressed-key-with-e-which-in-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Associative Arrays Coding Style</title>
		<link>/2010/05/19/php-associative-arrays-coding-style/</link>
		<comments>/2010/05/19/php-associative-arrays-coding-style/#comments</comments>
		<pubDate>Wed, 19 May 2010 14:14:03 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Curly bracket programming languages]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[Initialisms]]></category>
		<category><![CDATA[PHAML]]></category>
		<category><![CDATA[PHP programmer]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[Procedural programming languages]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">/?p=1532</guid>
		<description><![CDATA[No PHP programmer writes code without arrays. Sound strange, but as many programmers there are, as many ways to format the array notation there are. My advice is to rely on a defined standard. I personally use the Zend Framework&#8217;s coding style. So how to format the code? The first way is on the same &#8230; <a href="/2010/05/19/php-associative-arrays-coding-style/" class="more-link">Continue reading <span class="screen-reader-text">PHP Associative Arrays Coding Style</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/12/03/javascript-objects-coding-style-reviewed/" rel="bookmark" title="JavaScript Objects Coding Style Reviewed">JavaScript Objects Coding Style Reviewed </a></li>
<li><a href="/2010/05/25/php-coding-style-large-if-statements/" rel="bookmark" title="PHP Coding Style: Large IF Statements">PHP Coding Style: Large IF Statements </a></li>
<li><a href="/2010/05/24/javascript-objects-coding-style/" rel="bookmark" title="JavaScript Objects Coding Style">JavaScript Objects Coding Style </a></li>
<li><a href="/2010/05/26/php-conditionals-coding-style/" rel="bookmark" title="PHP: Conditionals Coding Style">PHP: Conditionals Coding Style </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>No PHP programmer writes code without arrays. Sound strange, but as many programmers there are, as many ways to format the array notation there are.</p>
<p>My advice is to rely on a defined standard. I personally use the Zend Framework&#8217;s coding style.</p>
<p>So how to format the code? The first way is on the same line:</p>
<pre lang="php" escaped="true">$myArray = array('key1' =&gt; 'value1',
		 'key2' =&gt; 'value2');
</pre>
<p>And the other, perhaps more clear way is to place the associative pairs on a new line:</p>
<pre lang="php" escaped="true">$myArray = array(
	'key1' =&gt; 'value1',
	'key2' =&gt; 'value2',
);
</pre>
<p>Note that in the second example there&#8217;s a comma after the second pair. This is correct PHP syntax and is strongly encouraged!</p>
<p>It&#8217;s up to you which way to take. However it mainly depends on the case, but please use standards.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/12/03/javascript-objects-coding-style-reviewed/" rel="bookmark" title="JavaScript Objects Coding Style Reviewed">JavaScript Objects Coding Style Reviewed </a></li>
<li><a href="/2010/05/25/php-coding-style-large-if-statements/" rel="bookmark" title="PHP Coding Style: Large IF Statements">PHP Coding Style: Large IF Statements </a></li>
<li><a href="/2010/05/24/javascript-objects-coding-style/" rel="bookmark" title="JavaScript Objects Coding Style">JavaScript Objects Coding Style </a></li>
<li><a href="/2010/05/26/php-conditionals-coding-style/" rel="bookmark" title="PHP: Conditionals Coding Style">PHP: Conditionals Coding Style </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/05/19/php-associative-arrays-coding-style/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Modyfing Response Headers with Zend Framework</title>
		<link>/2010/03/24/modyfing-response-headers-with-zend-framework/</link>
		<comments>/2010/03/24/modyfing-response-headers-with-zend-framework/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 18:53:46 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Curly bracket programming languages]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[Human Interest]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[Scripting languages]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Web application frameworks]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">/?p=1383</guid>
		<description><![CDATA[Response Headers You&#8217;ve probably seen that you can track the server response headers with Firebug &#8211; a wonderful extension to Firefox. But have you ever asked yourself how to change a response header with Zend Framework. header() Typically this is done with the built in PHP function header, where you can setup the header the &#8230; <a href="/2010/03/24/modyfing-response-headers-with-zend-framework/" class="more-link">Continue reading <span class="screen-reader-text">Modyfing Response Headers with Zend Framework</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/06/10/json-and-zend-framework-zend_json/" rel="bookmark" title="JSON and Zend Framework? &#8211; Zend_Json">JSON and Zend Framework? &#8211; Zend_Json </a></li>
<li><a href="/2010/05/25/download-files-with-zend-framework/" rel="bookmark" title="Download Files with Zend Framework">Download Files with Zend Framework </a></li>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2010/01/25/using-zend-framework-validators-zend_validate_db_recordexists/" rel="bookmark" title="Using Zend Framework validators &#8211; Zend_Validate_Db_RecordExists">Using Zend Framework validators &#8211; Zend_Validate_Db_RecordExists </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Response Headers</h2>
<p>You&#8217;ve probably seen that you can track the server response headers with Firebug &#8211; a wonderful extension to Firefox.</p>
<p><a href="/wp-content/uploads/2010/03/Picture-11.png"><img class="aligncenter size-medium wp-image-1384" title="Firebug Response Headers" src="/wp-content/uploads/2010/03/Picture-11-300x86.png" alt="" width="300" height="86" srcset="/wp-content/uploads/2010/03/Picture-11-300x86.png 300w, /wp-content/uploads/2010/03/Picture-11.png 518w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>But have you ever asked yourself how to change a response header with Zend Framework.</p>
<h2>header()</h2>
<p>Typically this is done with the built in PHP function header, where you can setup the header the page must return, but how to make it with Zend Framework?</p>
<p>It&#8217;s pretty simple of course, it&#8217;s Zend Framework in fact. To be more precise I&#8217;ll post a snippet:</p>
<pre lang="php" escaped="true">
$response = $this-&gt;getResponse();
$response-&gt;setHeader('content-type', 'application/x-javascript; charset=utf-8');
$response-&gt;sendResponse();
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/06/10/json-and-zend-framework-zend_json/" rel="bookmark" title="JSON and Zend Framework? &#8211; Zend_Json">JSON and Zend Framework? &#8211; Zend_Json </a></li>
<li><a href="/2010/05/25/download-files-with-zend-framework/" rel="bookmark" title="Download Files with Zend Framework">Download Files with Zend Framework </a></li>
<li><a href="/2010/07/21/setting-up-global-cache-in-zend-framework/" rel="bookmark" title="Setting Up Global Cache in Zend Framework">Setting Up Global Cache in Zend Framework </a></li>
<li><a href="/2010/01/25/using-zend-framework-validators-zend_validate_db_recordexists/" rel="bookmark" title="Using Zend Framework validators &#8211; Zend_Validate_Db_RecordExists">Using Zend Framework validators &#8211; Zend_Validate_Db_RecordExists </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/03/24/modyfing-response-headers-with-zend-framework/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
