<?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>how-to &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/how-to/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>PHP: Don&#8217;t Call the Destructor Explicitly</title>
		<link>/2011/11/14/php-dont-call-the-destructor-explicitly/</link>
		<comments>/2011/11/14/php-dont-call-the-destructor-explicitly/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 16:26:23 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[destructor]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[Object-oriented programming]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[php examples]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[Scripting languages]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">/?p=2461</guid>
		<description><![CDATA[&#8220;PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as C++&#8221;[1] says the documentation for destructors, but let&#8217;s see the following class. class A { public function __construct() { echo 'building an object'; } public function __destruct() { echo 'destroying the object'; } } $obj = new A(); Well, as &#8230; <a href="/2011/11/14/php-dont-call-the-destructor-explicitly/" class="more-link">Continue reading <span class="screen-reader-text">PHP: Don&#8217;t Call the Destructor Explicitly</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/10/20/some-notes-on-the-object-oriented-model-of-php/" rel="bookmark" title="Some Notes on the Object-oriented Model of PHP">Some Notes on the Object-oriented Model of PHP </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>
<li><a href="/2012/04/26/php-strings-dont-need-quotes/" rel="bookmark" title="PHP Strings Don&#8217;t Need Quotes">PHP Strings Don&#8217;t Need Quotes </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><em>&#8220;PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as C++&#8221;</em><a href="http://www.php.net/manual/en/language.oop5.decon.php" title="PHP: Constructors and Destructors" target="_blank">[1]</a> says the documentation for destructors, but let&#8217;s see the following class.</p>
<pre lang="PHP">
class A
{
	public function __construct()
	{
		echo 'building an object';
	}
	
	public function __destruct()
	{
		echo 'destroying the object';
	}
}

$obj = new A();
</pre>
<p>Well, as you can not call the constructor explicitly:</p>
<pre lang="PHP">
$obj->__construct();
</pre>
<p>So we should not call the destructor explicitly:</p>
<pre lang="PHP">
$obj->__destruct();
</pre>
<p>The problem is that I&#8217;ve seen this many times, but it&#8217;s a pity that this won&#8217;t destroy the object and it is still a valid PHP code.<br />
<span id="more-2461"></span><br />
<figure id="attachment_2465" style="width: 620px" class="wp-caption alignnone"><a href="/wp-content/uploads/2011/11/destruct.jpg"><img src="/wp-content/uploads/2011/11/destruct.jpg" alt="PHP destructors can&#039;t be called explicitly!" title="destruct" width="620" height="427" class="size-full wp-image-2465" /></a><figcaption class="wp-caption-text">PHP destructors cannot be called explicitely!</figcaption></figure></p>
<p>Constructors and destructors in <a href="/category/php/" title="PHP on stoimen.com">PHP</a> are part of the so called magic methods. Here&#8217;s what the <a href="http://php.net/manual/en/language.oop5.magic.php" title="PHP: Magic Methods" target="_blank">doc page</a> says about them.</p>
<blockquote><p>
The function names __construct(), __destruct(), __call(), __callStatic(), __get(), __set(), __isset(), __unset(), __sleep(), __wakeup(), __toString(), __invoke(), __set_state() and __clone() are magical in PHP classes. You cannot have functions with these names in any of your classes unless you want the magic functionality associated with them.</p></blockquote>
<p>To be more precise let&#8217;s take a look of the definition of destructors. </p>
<blockquote><p>PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as C++. The destructor method will be called as soon as there are no other references to a particular object, or in any order during the shutdown sequence.</p></blockquote>
<h2>What if I Call the Destructor Explicitly?</h2>
<p>Let&#8217;s see some examples!</p>
<pre lang="PHP">
class A
{
	public function __destruct()
	{
		echo 'destroying the object';
	}
}

$obj = new A();

// prints hello world
echo 'hello world';

// PHP interpreter stops the script execution and prints
// 'destroying the object'
</pre>
<p>This is actually a normal behavior. At the end of the script the interpreter frees the memory. Actually every object has a built-in destructor, just like it has built-in constructor. So even we don&#8217;t define it explicitly, the object has its destructor. Usually this destructor is executed at the end of the script, or whenever the object isn&#8217;t needed anymore. This can happen, for instance, at the end of a function body.</p>
<p>Now if we call the destructor explicitly, which as I said I&#8217;ve seen many times, here&#8217;s what happen.</p>
<pre lang="PHP">
class A
{
	public function __destruct()
	{
		echo 'destroying the object';
	}
}

$obj = new A();

// this is valid and it prints 'destroying the object'
// BUT IT DOES NOT DESTROY THE OBJECT
$obj->__destruct();

// prints hello world
echo 'hello world';

// HERE PHP ACTUALLY DESTROYS THE $obj OBJECT
// ... and again prints 'destroying the object'
</pre>
<p>As you can see calling the destructor explicitly doesn&#8217;t destroy the object. So the question is &#8230;</p>
<h2>How to Destroy an Object Before the Script Stops?</h2>
<p>Well, to destroy an object you can assign a NULL value to it.</p>
<pre lang="PHP">
class A
{
	public function __destruct()
	{
		echo 'destroying the object';
	}
}

$obj = new A();

// prints 'destroying the object'
$obj = null;

// prints 'hello world'
echo 'hello world';

// the script stop its execution
</pre>
<h2>Caution</h2>
<p>Be aware of that if you don&#8217;t clone the object $obj, and simply assign it to another variable, then $obj = null will be pointless. Let&#8217;s see the following example.</p>
<pre lang="PHP">
class A 
{
	public function printMsg()
	{
		echo 'I still exist';
	}
	
	public function __destruct()
	{
		echo 'destroying the object';
	}

}

$obj = new A();

// $newObj is pointing to $obj
$newObj = $obj;

// this doesn't destroy $newObj
// as it appears both $obj and $newObj point to the same memory
// so PHP doesn't free this memory
$obj = null;

// prints 'i still exist'
$newObj->printMsg();

// prints 'hello world'
echo 'hello world';

// now the scripts destroys the "object", which in this
// case is $newObj and prints 'destroying the object'
</pre>
<p>This example shows us that actually by assigning NULL to an object doesn&#8217;t quite destroy it if there are another objects pointing to the same memory.</p>
<pre lang="PHP">
class A 
{
	public function printMsg()
	{
		echo 'I still exist';
	}
	
	public function __destruct()
	{
		echo 'destroying the object';
	}

}

$b = new A();

$d = $c = $b;

$b = null;

$c->printMsg();
$d->printMsg();

// prints 'destroying the object' ONLY ONCE
</pre>
<p>In this last example there are two interesting things to note. First <strong>$b = null</strong> doesn&#8217;t call the destructor, and at the end of the script there&#8217;s only one implicit call of the destructor, although there are two objects.</p>
<h2>Conclusion</h2>
<p>The important thing to note is that you shouldn’t call the destructor of an object explicitly! Not because it will throw an fatal error, but simply because it won’t destroy the object.</p>
<p>[1] <a href="http://www.php.net/manual/en/language.oop5.decon.php" title="PHP: Constructors and Destructors" target="_blank">PHP: Constructors and Destructors</a></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/10/20/some-notes-on-the-object-oriented-model-of-php/" rel="bookmark" title="Some Notes on the Object-oriented Model of PHP">Some Notes on the Object-oriented Model of PHP </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>
<li><a href="/2012/04/26/php-strings-dont-need-quotes/" rel="bookmark" title="PHP Strings Don&#8217;t Need Quotes">PHP Strings Don&#8217;t Need Quotes </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>/2011/11/14/php-dont-call-the-destructor-explicitly/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>How to Check if a Date is More or Less Than a Month Ago with PHP</title>
		<link>/2011/11/04/how-to-check-if-a-date-is-more-or-less-than-a-month-ago-with-php/</link>
		<comments>/2011/11/04/how-to-check-if-a-date-is-more-or-less-than-a-month-ago-with-php/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 14:45:52 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[date and time]]></category>
		<category><![CDATA[dates]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[strtotime]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[unix timestamp]]></category>

		<guid isPermaLink="false">/?p=2418</guid>
		<description><![CDATA[Let&#8217;s say we have the following problem: we have to check whether a date is more than a month ago or less than a month ago. Many developers go in the wrong direction by calculating the current month and then subtracting the number of months from it. Of course, this approach is slow and full &#8230; <a href="/2011/11/04/how-to-check-if-a-date-is-more-or-less-than-a-month-ago-with-php/" class="more-link">Continue reading <span class="screen-reader-text">How to Check if a Date is More or Less Than a Month Ago with PHP</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/08/10/javascript-get-locale-month-with-full-name/" rel="bookmark" title="javascript get locale month with full name">javascript get locale month with full name </a></li>
<li><a href="/2012/03/16/you-think-you-know-php-quiz-results/" rel="bookmark" title="You think you know PHP. Quiz Results!">You think you know PHP. Quiz Results! </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="/2012/04/26/php-strings-dont-need-quotes/" rel="bookmark" title="PHP Strings Don&#8217;t Need Quotes">PHP Strings Don&#8217;t Need Quotes </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Let&#8217;s say we have the following problem: we have to check whether a date is more than a month ago or less than a month ago. Many developers go in the wrong direction by calculating the current month and then subtracting the number of months from it. Of course, this approach is slow and full of risks of allowing bugs. Since, two months before January, which is the first month of the year, is actually November, which is the eleventh month. Because of these pitfalls, this approach is entirely wrong.<br />
<figure id="attachment_2442" style="width: 480px" class="wp-caption alignnone"><a href="/wp-content/uploads/2011/11/calendar.jpg"><img src="/wp-content/uploads/2011/11/calendar.jpg" alt="strtotime() is a lot more powerful than you think!" title="calendar" width="480" height="553" class="size-full wp-image-2442" srcset="/wp-content/uploads/2011/11/calendar.jpg 480w, /wp-content/uploads/2011/11/calendar-260x300.jpg 260w" sizes="(max-width: 480px) 100vw, 480px" /></a><figcaption class="wp-caption-text">strtotime() is a lot more powerful than you think!</figcaption></figure></p>
<p>The question is whether PHP cannot help us with built-in functions to perform these calculations for us. It is obvious, that from version 5.3.0 and later, there is an OOP section, which is great, but unfortunately this version is still not updated everywhere. So, how to accomplish the task?</p>
<h2>The Wrong Approach</h2>
<p>As I said, there are many ways to go in the wrong direction. One of them is to subtract 30 days from current date. This is completely wrong, because not every month has 30 days. Here, some developers will begin to predefine arrays to indicate the number of days in each month, which then will be used in their complicated calculations. Here is an example of this wrong approach.</p>
<pre lang="PHP">
echo date('Y-m-d', strtotime(date('Y-m-d')) - 60*60*24*30);
</pre>
<p>This line is full of mistakes. First of all <strong>strtotime(date(&#8216;Y-m-d&#8217;))</strong> can be replaced by the more elegant <strong>strtotime(&#8216;now&#8217;)</strong>, but for this later. Another big mistake is that <strong>60*60*24*30</strong>, which is <strong>number of seconds in 30 days</strong> can be predefined as a constant. Eventually the result is wrong, because not every month has 30 days.</p>
<h2>The Correct Approach</h2>
<p>A small research of the problem and the functions in versions prior of 5.3.0 of PHP is needed. Typical case study of date formatting happen when working with dates from a database. The following code is a classical example.<span id="more-2418"></span></p>
<pre lang="PHP">
// 2008 05 23, 2008-05-23 is stored into the DB
echo date('Y m d', strtotime('2008-05-23'));

// 2008 May 23
echo date('Y F d', strtotime('2008-05-23'));
</pre>
<p>The problem, perhaps, is that too often <a href="http://php.net/manual/en/function.strtotime.php" title="PHP: strtotime" target="_blank">strtotime()</a> is used like this, with exactly this type of strings. However much more interesting is that strtotime() can do much more. </p>
<h2>strtotime() Can Do Much More</h2>
<p>Let us first look at the documentation of this function. What parameters it accepts?</p>
<pre lang="PHP">
int strtotime ( string $time [, int $now = time() ] )
</pre>
<blockquote><p>The function expects to be given a string containing an English date format and will try to parse that format into a Unix timestamp (the number of seconds since January 1 1970 00:00:00 UTC), relative to the timestamp given in now, or the current time if now is not supplied.</p></blockquote>
<p>In particular we are interested in the first parameter, <em>time</em>.</p>
<blockquote><p><em>time </em>&#8211; A date/time string. Valid formats are explained in Date and Time Formats.</p></blockquote>
<p>It is especially important to note what are the <a href="http://www.php.net/manual/en/datetime.formats.php" title="PHP: Supported Date and Time Formats" target="_blank">valid Date and Time Formats</a>.</p>
<p>Here are the supported formats, but most interesting are those that are <a href="http://www.php.net/manual/en/datetime.formats.relative.php" title="PHP: Relative Formats" target="_blank">Relative</a>.</p>
<p>Exactly these formats are very convenient in our case, because they give us the ability to work with human readable strings, and here are some examples from the documentation of strtotime().</p>
<pre lang="PHP">
echo strtotime("now"), "\n";
echo strtotime("10 September 2000"), "\n";
echo strtotime("+1 day"), "\n";
echo strtotime("+1 week"), "\n";
echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n";
echo strtotime("next Thursday"), "\n";
echo strtotime("last Monday"), "\n";
</pre>
<p>Thus, a valid string would be &#8220;1 month ago&#8221;.</p>
<pre lang="PHP">
// if current date is 2011-11-04, this will return 2011-10-04
echo date('Y-m-d', strtotime('1 month ago'))
</pre>
<p>Or &#8220;-1 month&#8221;:</p>
<pre lang="PHP">
// the same as the example above
echo date('Y-m-d', strtotime('-1 month'));
</pre>
<p>It&#8217;s interesting that &#8220;+1 -1 month&#8221; is also a valid string.</p>
<pre lang="PHP">
// 2011-10-04, if today's 2011-11-04
echo date('Y-m-d', strtotime('+1 -1 month'));
</pre>
<p>In fact strtotime() can do a lot more than most of the developers have ever imagined. Maybe its frequent use with string formatted dates (2010-01-13) makes it a bit unknown. Here are some interesting use cases.</p>
<pre lang="PHP">
// 1970-01-01, Calculations in braces are bad!
echo date('Y-m-d', strtotime('(60*60) minute'));

// 2 months into the future
echo date('Y-m-d', strtotime('-2 months ago'));
</pre>
<p>For instance, do you know how to get the date of the day before yesterday? Yes 2 days before today, but here&#8217;s yet another solution.</p>
<pre lang="PHP">
// 1 day before yesterday
echo date('Y-m-d', strtotime('yesterday -1 day'));
</pre>
<p>Another example is the fully human readable:</p>
<pre lang="PHP">
// get the first monday of the current month
echo date('Y-m-d', strtotime('first monday this month'));
</pre>
<h2>The Solution of the Task</h2>
<p>Finally, what is the solution of the original task? Well, just have to check whether a date is more or less than a month ago.</p>
<pre lang="PHP">
// a random date
$my_date = '2011-09-23';
	
// true if my_date is more than a month ago
(strtotime($my_date) < strtotime('1 month ago'))
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/08/10/javascript-get-locale-month-with-full-name/" rel="bookmark" title="javascript get locale month with full name">javascript get locale month with full name </a></li>
<li><a href="/2012/03/16/you-think-you-know-php-quiz-results/" rel="bookmark" title="You think you know PHP. Quiz Results!">You think you know PHP. Quiz Results! </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="/2012/04/26/php-strings-dont-need-quotes/" rel="bookmark" title="PHP Strings Don&#8217;t Need Quotes">PHP Strings Don&#8217;t Need Quotes </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2011/11/04/how-to-check-if-a-date-is-more-or-less-than-a-month-ago-with-php/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Some Notes on the Object-oriented Model of PHP</title>
		<link>/2011/10/20/some-notes-on-the-object-oriented-model-of-php/</link>
		<comments>/2011/10/20/some-notes-on-the-object-oriented-model-of-php/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 15:08:15 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[abstract classes]]></category>
		<category><![CDATA[Abstract type]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Class]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[iheritance]]></category>
		<category><![CDATA[Interfaces]]></category>
		<category><![CDATA[Java programming language]]></category>
		<category><![CDATA[Method]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[Object-oriented programming]]></category>
		<category><![CDATA[php 5]]></category>
		<category><![CDATA[php class definition]]></category>
		<category><![CDATA[php experiment]]></category>
		<category><![CDATA[php tutorial]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[Polymorphism in object-oriented programming]]></category>
		<category><![CDATA[Software design patterns]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[Virtual function]]></category>

		<guid isPermaLink="false">/?p=2401</guid>
		<description><![CDATA[PHP 5 introduces interfaces and abstract classes. To become a little clearer, let us see their definitions. Interfaces Object interfaces allow you to create code which specifies which methods a class must implement, without having to define how these methods are handled. Interfaces are defined using the interface keyword, in the same way as a &#8230; <a href="/2011/10/20/some-notes-on-the-object-oriented-model-of-php/" class="more-link">Continue reading <span class="screen-reader-text">Some Notes on the Object-oriented Model of PHP</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/05/30/object-oriented-javascript-inheritance/" rel="bookmark" title="Object Oriented JavaScript: Inheritance">Object Oriented JavaScript: Inheritance </a></li>
<li><a href="/2011/07/28/oop-javascript-accessing-public-methods-in-private-methods/" rel="bookmark" title="OOP JavaScript: Accessing Public Methods in Private Methods">OOP JavaScript: Accessing Public Methods in Private Methods </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>
<li><a href="/2011/11/14/php-dont-call-the-destructor-explicitly/" rel="bookmark" title="PHP: Don&#8217;t Call the Destructor Explicitly">PHP: Don&#8217;t Call the Destructor Explicitly </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>PHP 5 introduces interfaces and abstract classes. To become a little clearer, let us see their definitions.</p>
<h2>Interfaces</h2>
<blockquote><p>Object interfaces allow you to create code which specifies which methods a class must implement, without having to define how these methods are handled.<br />
Interfaces are defined using the interface keyword, in the same way as a standard class, but without any of the methods having their contents defined.<br />
All methods declared in an interface must be public, this is the nature of an interface. </p>
<p>To implement an interface, the implements operator is used. All methods in the interface must be implemented within a class; failure to do so will result in a fatal error. Classes may implement more than one interface if desired by separating each interface with a comma. </p></blockquote>
<h2>Abstract Classes</h2>
<blockquote><p>PHP 5 introduces abstract classes and methods. Classes defined as abstract may not be instantiated, and any class that contains at least one abstract method must also be abstract. Methods defined as abstract simply declare the method&#8217;s signature &#8211; they cannot define the implementation.</p>
<p>When inheriting from an abstract class, all methods marked abstract in the parent&#8217;s class declaration must be defined by the child; additionally, these methods must be defined with the same (or a less restricted) visibility. For example, if the abstract method is defined as protected, the function implementation must be defined as either protected or public, but not private. Furthermore the signatures of the methods must match, i.e. the type hints and the number of required arguments must be the same. This also applies to constructors as of PHP 5.4. Before 5.4 constructor signatures could differ. </p></blockquote>
<h2>Some Cases</h2>
<p>Now let&#8217;s do a quick experiment. According to the definition of interfaces we can define an interface and than an abstract class can implement this interface.<br />
<span id="more-2401"></span></p>
<pre lang="PHP">
interface A
{
	public function a();
}

abstract class B implements A
{
	public function a()
	{
		return 10;
	}
}
</pre>
<p>However the abstract class cannot be instantiated so we need to extend it.</p>
<pre lang="PHP">
interface A
{
	public function a();
}

abstract class B implements A
{
	public function a()
	{
		return 10;
	}
}

class C extends B
{
	...
}
</pre>
<p>In the first place is completely OK to define an abstract class that does not contain any abstract method. TUsually if a class has one or more abstract methods <em>(Methods defined as abstract simply declare the method&#8217;s signature &#8211; they cannot define the implementation, according to the docs)</em>, it must be defined as abstract. But we can also define an abstract class which has no abstract methods.</p>
<pre lang="PHP">
abstract class B
{
	public function a()
	{
		return 5;
	}
}

class C extends B
{
	public function a()
	{
		return 10;
	}
}

$c = new C();
echo $c->a();
</pre>
<p>OK then what would happen if we had an interface that is implemented by an abstract class, which in turn is extended by a given class. First of all if a class implements an interface, even if it is an abstract class, it must implement all methods defined in the interface. So if the predefined method in the abstract class is marked as abstract, it would result into a fatal error.</p>
<pre lang="PHP">
interface A
{
	public function a();
}

abstract class B implements A
{
	abstract public function a();
}

class C extends B
{
	public function a()
	{
		return 5;
	}
}

$c = new C();
echo $c->a();
</pre>
<p>This is perfectly logical, because in fact each method of the interface must be implemented by his children.</p>
<p><em>&#8220;All methods in the interface must be implemented within a class; failure to do so will result in a fatal error.&#8221;<br />
</em><br />
Fine, but we can have abstract classes with no abstract methods, let&#8217;s try this:</p>
<pre lang="PHP">
interface A
{
	public function a();
}

abstract class B implements A
{
	public function a()
	{
		return 10;
	}
}

class C extends B
{
	public function a()
	{
		return 5;
	}
}

$c = new C();
echo $c->a();
</pre>
<p>This code is working and the result is the returned value from C::a(). However class B is abstract so let&#8217;s go even further. Let&#8217;s define an abstract method, different from the method B::a().</p>
<pre lang="PHP">
interface A
{
	public function a();
}

abstract class B implements A
{
	public function a()
	{
		return 10;
	}
	
	abstract public function b();
}

class C extends B
{
	public function a()
	{
		return 5;
	}
	
	public function b()
	{
		return "hello world!";
	}
}

$c = new C();
echo $c->a();
echo $c->b();
</pre>
<p>Now there&#8217;s a fatal error. Why?</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/05/30/object-oriented-javascript-inheritance/" rel="bookmark" title="Object Oriented JavaScript: Inheritance">Object Oriented JavaScript: Inheritance </a></li>
<li><a href="/2011/07/28/oop-javascript-accessing-public-methods-in-private-methods/" rel="bookmark" title="OOP JavaScript: Accessing Public Methods in Private Methods">OOP JavaScript: Accessing Public Methods in Private Methods </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>
<li><a href="/2011/11/14/php-dont-call-the-destructor-explicitly/" rel="bookmark" title="PHP: Don&#8217;t Call the Destructor Explicitly">PHP: Don&#8217;t Call the Destructor Explicitly </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2011/10/20/some-notes-on-the-object-oriented-model-of-php/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Thing to Know About PHP Arrays</title>
		<link>/2011/10/19/thing-to-know-about-php-arrays/</link>
		<comments>/2011/10/19/thing-to-know-about-php-arrays/#respond</comments>
		<pubDate>Wed, 19 Oct 2011 15:18:47 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Arrays]]></category>
		<category><![CDATA[C programming language]]></category>
		<category><![CDATA[Comparison of programming languages]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Data structures]]></category>
		<category><![CDATA[Data types]]></category>
		<category><![CDATA[Foreach]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[interpreter]]></category>
		<category><![CDATA[PHP arrays]]></category>
		<category><![CDATA[PHP micro tutorial]]></category>
		<category><![CDATA[php tutorial]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">/?p=2390</guid>
		<description><![CDATA[Consider the following case. We have an array with identical keys. $arr = array(1 => 10, 1 => 11); What happens when the interpreter reaches this line of code? This is not a syntax error and it is completely valid. Very similar, but more interesting case is when we have an array of identical keys, &#8230; <a href="/2011/10/19/thing-to-know-about-php-arrays/" class="more-link">Continue reading <span class="screen-reader-text">Thing to Know About PHP Arrays</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/08/31/php-what-is-more-powerful-than-list-perhaps-extract/" rel="bookmark" title="PHP: What is More Powerful Than list() &#8211; Perhaps extract()">PHP: What is More Powerful Than list() &#8211; Perhaps extract() </a></li>
<li><a href="/2012/07/24/php-arrays-or-linked-lists/" rel="bookmark" title="PHP: Arrays or Linked Lists?">PHP: Arrays or Linked Lists? </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="/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>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Consider the following case. We have an array with identical keys. </p>
<pre lang="PHP">
$arr = array(1 => 10, 1 => 11);
</pre>
<p>What happens when the interpreter reaches this line of code? This is not a syntax error and it is completely valid. Very similar, but more interesting case is when we have an array of identical keys, where those identical keys are represented once as an integer and then as a string.<br />
<figure id="attachment_2404" style="width: 640px" class="wp-caption aligncenter"><a href="/wp-content/uploads/2011/10/php.code_.jpg"><img src="/wp-content/uploads/2011/10/php.code_.jpg" alt="Keys in PHP arrays are not type sensitive, so pay attention when using them!" title="PHP Code" width="640" height="480" class="size-full wp-image-2404" srcset="/wp-content/uploads/2011/10/php.code_.jpg 640w, /wp-content/uploads/2011/10/php.code_-300x225.jpg 300w" sizes="(max-width: 640px) 100vw, 640px" /></a><figcaption class="wp-caption-text">Keys in PHP arrays are not type sensitive, so pay attention when using them!</figcaption></figure></p>
<pre lang="PHP">
$arr = array(1 => 10, "1" => 11);
</pre>
<p>Now several questions arise. First of all, how many elements have this array? Two or one. This can be easily verified by checking what count() will return.<span id="more-2390"></span></p>
<pre lang="PHP">
echo count($arr);
</pre>
<p>The correct answer is 1. This simply means, that there&#8217;s no difference between string keys and integer keys. What would happen if we had a &#8220;normal&#8221; array with different keys?</p>
<pre lang="PHP">
$arr = array(1 => 10, "2" => 11);
echo count($arr);
</pre>
<p>As expected this returns 2. </p>
<p>Next thing to check is what&#8217;s in the array after this initialization line.</p>
<pre lang="PHP">
$arr = array(1 => 10, "1" => 11);
</pre>
<p>Is there something in the first element $arr[0], or there&#8217;s something in the second element $arr[1]? What is the value of the single value?<br />
As it appears the second element replaces the first one. We&#8217;ve seen that the array has only one value, but where&#8217;s that value? The only way to check this is to dump both elements:</p>
<pre lang="PHP">
var_dump($arr);
</pre>
<p>Here we can see that $arr[1] contains &#8220;11&#8221; and it is the only value, and $arr[0] is not set.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/08/31/php-what-is-more-powerful-than-list-perhaps-extract/" rel="bookmark" title="PHP: What is More Powerful Than list() &#8211; Perhaps extract()">PHP: What is More Powerful Than list() &#8211; Perhaps extract() </a></li>
<li><a href="/2012/07/24/php-arrays-or-linked-lists/" rel="bookmark" title="PHP: Arrays or Linked Lists?">PHP: Arrays or Linked Lists? </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="/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>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2011/10/19/thing-to-know-about-php-arrays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scroll an IFRAME Content to a Predefined Position</title>
		<link>/2011/03/29/scroll-an-iframe-content-to-a-predefined-position/</link>
		<comments>/2011/03/29/scroll-an-iframe-content-to-a-predefined-position/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 11:43:36 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[absolute iframe content]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">/?p=2238</guid>
		<description><![CDATA[IFRAME Source Usually when you use an IFRAME tag to link an external source the page that&#8217;s referenced by the SRC attributes is loaded at the top left corner. This is the default behavior, but sometimes you&#8217;d like to show to your users not the entire page from the top left corner, but to show &#8230; <a href="/2011/03/29/scroll-an-iframe-content-to-a-predefined-position/" class="more-link">Continue reading <span class="screen-reader-text">Scroll an IFRAME Content to a Predefined Position</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/04/24/scroll-the-page-with-javascript/" rel="bookmark" title="Scroll the page with JavaScript">Scroll the page with JavaScript </a></li>
<li><a href="/2010/01/24/css-default-position-value/" rel="bookmark" title="CSS default position value">CSS default position value </a></li>
<li><a href="/2009/06/11/remove-iframe-border-on-ie/" rel="bookmark" title="remove iframe border on IE">remove iframe border on IE </a></li>
<li><a href="/2009/11/10/jquery-css-functions-part-1-offset/" rel="bookmark" title="jQuery CSS functions. Part 1 &#8211; offset()">jQuery CSS functions. Part 1 &#8211; offset() </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>IFRAME Source</h2>
<p>Usually when you use an <a href="/tag/iframe/">IFRAME</a> tag to link an external source the page that&#8217;s referenced by the SRC attributes is loaded at the top left corner. This is the default behavior, but sometimes you&#8217;d like to show to your users not the entire page from the top left corner, but to show only part of the external page instead.</p>
<p>In most of the cases the reference is external and you don&#8217;t have control over the external page. Thus you&#8217;ve to scroll the IFRAME content to the desired position. This of course is impossible. Yeah, there are some JavaScript hacks, but they&#8217;re all a bad solution, because the scrolling occurs only after the page is loaded.</p>
<h2>The Solution</h2>
<p>You can wrap the <a href="/tag/iframe/">IFRAME</a> into a div and scroll the DIV content using absolute TOP and LEFT <a href="/tag/css/">CSS</a> properties.</p>
<p>Here&#8217;s an example:</p>
<pre lang="css">
#my-div
{
    width    : 400px;
    height   : 200px;
    overflow : hidden;
    position : relative;
}

#my-iframe
{
    position : absolute;
    top      : -100px;
    left     : -100px;
    width    : 1280px;
    height   : 1200px;
}
</pre>
<p>Here you have one DIV with dimensions 400x200px. Now by moving the IFRAME within it you can position it on the right place.</p>
<pre lang="html4strict">
<div id="my-div">
<iframe src="http://www.example.com/" id="my-iframe" scrolling="no"></iframe>
</div>
</pre>
<p><span id="more-2238"></span><br />
Example with the awesome <a href="http://www.yahoo.com/" target="_blank" title="Yahoo! Homepage">Yahoo! Homepage</a>:<br />
<iframe src="http://stoimen.com/projects/iframe.scrolled.content/" scrolling="no" frameborder="0" style="width:400px;height:390px"></iframe></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/04/24/scroll-the-page-with-javascript/" rel="bookmark" title="Scroll the page with JavaScript">Scroll the page with JavaScript </a></li>
<li><a href="/2010/01/24/css-default-position-value/" rel="bookmark" title="CSS default position value">CSS default position value </a></li>
<li><a href="/2009/06/11/remove-iframe-border-on-ie/" rel="bookmark" title="remove iframe border on IE">remove iframe border on IE </a></li>
<li><a href="/2009/11/10/jquery-css-functions-part-1-offset/" rel="bookmark" title="jQuery CSS functions. Part 1 &#8211; offset()">jQuery CSS functions. Part 1 &#8211; offset() </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2011/03/29/scroll-an-iframe-content-to-a-predefined-position/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Adding a Custom Button to TinyMCE</title>
		<link>/2011/02/16/adding-a-custom-button-to-tinymce/</link>
		<comments>/2011/02/16/adding-a-custom-button-to-tinymce/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 08:31:04 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[CKEditor]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[FCKEditor]]></category>
		<category><![CDATA[Google Inc.]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[JavaScript programming language]]></category>
		<category><![CDATA[online based editor]]></category>
		<category><![CDATA[opinion]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[TinyMCE]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[WYSIWYG]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">/?p=2176</guid>
		<description><![CDATA[TinyMCE First thing to say TinyMCE is a very popular WYSIWYG online based editor. It&#8217;s very widely used in the web, as may already know it it&#8217;s part of the default WordPress installation. Out of the web, of course, there are some other editors as well. The most used and well developed projects are the &#8230; <a href="/2011/02/16/adding-a-custom-button-to-tinymce/" class="more-link">Continue reading <span class="screen-reader-text">Adding a Custom Button to TinyMCE</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/02/17/adding-a-custom-button-to-tinymce-revised/" rel="bookmark" title="Adding a Custom Button to TinyMCE &#8211; REVISED">Adding a Custom Button to TinyMCE &#8211; REVISED </a></li>
<li><a href="/2010/01/31/speed-up-the-javascript-it-can-change-dramatically-the-user-experience/" rel="bookmark" title="Speed up the JavaScript. It can change dramatically the user experience.">Speed up the JavaScript. It can change dramatically the user experience. </a></li>
<li><a href="/2010/02/11/javascript-optimization-lazy-loading/" rel="bookmark" title="JavaScript optimization. Lazy loading.">JavaScript optimization. Lazy loading. </a></li>
<li><a href="/2011/04/05/jquery-unbind/" rel="bookmark" title="jQuery.unbind()">jQuery.unbind() </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>TinyMCE</h2>
<p>First thing to say <a title="TinyMCE Homepage" href="http://tinymce.moxiecode.com/" target="_blank">TinyMCE</a> is a very popular <a title="WYSIWYG Wikipedia page" href="http://en.wikipedia.org/wiki/WYSIWYG" target="_blank">WYSIWYG</a> online based editor. It&#8217;s very widely used in the web, as may already know it it&#8217;s part of the default WordPress installation. Out of the web, of course, there are some other editors as well. The most used and well developed projects are the <a title="YUI 2 Rich Text Editor Homepage" href="http://developer.yahoo.com/yui/editor/" target="_blank">Yahoo!&#8217;s YUI 2 Rich Text Editor</a> and <a title="CKEditor Homepage" href="http://ckeditor.com/" target="_blank">CKEditor</a> also known with his past name &#8211; FCKEditor.<a href="/wp-content/uploads/2011/02/TinyMCE_Full_Featured.png"><img class="aligncenter size-full wp-image-2206" title="TinyMCE_Full_Featured" src="/wp-content/uploads/2011/02/TinyMCE_Full_Featured.png" alt="TinyMCE Full Featured Example" width="640" height="528" srcset="/wp-content/uploads/2011/02/TinyMCE_Full_Featured.png 640w, /wp-content/uploads/2011/02/TinyMCE_Full_Featured-300x247.png 300w" sizes="(max-width: 640px) 100vw, 640px" /></a></p>
<p>Before I proceed with this post, let me say that I&#8217;m working and this tutorial is based on <strong>version 3.1.1</strong> released on <strong>18 Aug 2008</strong>.<span id="more-2176"></span></p>
<h2>Including TinyMCE</h2>
<p>The only thing you&#8217;ve to do is to include a TinyMCE javascript file and write a simple init. The examples of installing it come with the compressed version of the javascript file:</p>
<pre lang="html4strict">
<script src="/scripts/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script>
tinyMCE.init({
	mode : "textareas",
	theme : "advanced",
	force_br_newlines : true,
	theme_advanced_buttons1 : "link,unlink,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|",
	theme_advanced_buttons2 : "",
	theme_advanced_buttons3 : "",
	theme_advanced_buttons4 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "",
	theme_advanced_resizing : true
});
</script>
</pre>
<p>The result of this code is shown on the picture:</p>
<p><a href="/wp-content/uploads/2011/02/TinyMCE_Before.png"><img class="aligncenter size-full wp-image-2207" title="TinyMCE_Before" src="/wp-content/uploads/2011/02/TinyMCE_Before.png" alt="TinyMCE Before" width="653" height="313" srcset="/wp-content/uploads/2011/02/TinyMCE_Before.png 653w, /wp-content/uploads/2011/02/TinyMCE_Before-300x143.png 300w" sizes="(max-width: 653px) 100vw, 653px" /></a></p>
<p>However for this tutorial you&#8217;ve to include the uncompressed file, because the compressed one is impossible to read and modify. At the end of all this you can compress yet again the resulting file with some js compressor as <a title="YUI Compressor Homepage" href="http://developer.yahoo.com/yui/compressor/" target="_blank">YUI Compressor</a>, <a title="JSMin" href="http://www.crockford.com/javascript/jsmin.html" target="_blank">JSMin</a> or <a title="Google Closure Compiler Homepage" href="http://code.google.com/closure/compiler/" target="_blank">Google Closure Compiler</a>. So instead of including the file above, you&#8217;ve to include the _src version as it is:</p>
<pre lang="html4strict">
<script src="/scripts/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
</pre>
<h2>Adding the Button</h2>
<p>Now there is a small configuration object passed to the init function. First you&#8217;ve to modify it a bit:</p>
<pre lang="javascript">
tinyMCE.init({
	mode : "textareas",
	theme : "advanced",
	force_br_newlines : true,
	theme_advanced_buttons1 : "link,unlink,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,mybutton",
	theme_advanced_buttons2 : "",
	theme_advanced_buttons3 : "",
	theme_advanced_buttons4 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "",
	theme_advanced_resizing : true
});
</pre>
<p>Usually in the /tinymce/jscripts/tiny_mce/themes/advanced/editor_template_src.js file there are some buttons described:</p>
<pre lang="javascript">
tinymce.create('tinymce.themes.AdvancedTheme', {
	// Control name lookup, format: title, command
	controls : {
		bold : ['bold_desc', 'Bold'],
		italic : ['italic_desc', 'Italic'],
		underline : ['underline_desc', 'Underline'],
		strikethrough : ['striketrough_desc', 'Strikethrough'],
		justifyleft : ['justifyleft_desc', 'JustifyLeft'],
		justifycenter : ['justifycenter_desc', 'JustifyCenter'],
		justifyright : ['justifyright_desc', 'JustifyRight'],
		justifyfull : ['justifyfull_desc', 'JustifyFull'],
		bullist : ['bullist_desc', 'InsertUnorderedList'],
		numlist : ['numlist_desc', 'InsertOrderedList'],
		outdent : ['outdent_desc', 'Outdent'],
		indent : ['indent_desc', 'Indent'],
...
</pre>
<p>What you need to do is simply to add a new line to this config array:</p>
<pre lang="javascript">
...
        blockquote : ['blockquote_desc', 'mceBlockQuote'],
	mybutton : ['mybutton_desc','myFunc']
},
</pre>
<p>That&#8217;s not enough of course! Now TinyMCE sees this definition, but nothing happens. It cannot build the new button yet. What&#8217;s next?</p>
<h2>Styling the Button</h2>
<p>After giving the new button a name, TinyMCE constructs a markup with the given name into the controlbar:</p>
<p><a href="/wp-content/uploads/2011/02/TinyMCE_Button_Step-_1.png"><img class="aligncenter size-full wp-image-2208" title="TinyMCE_Button_Step _1" src="/wp-content/uploads/2011/02/TinyMCE_Button_Step-_1.png" alt="TinyMCE Button Step 1" width="654" height="315" srcset="/wp-content/uploads/2011/02/TinyMCE_Button_Step-_1.png 654w, /wp-content/uploads/2011/02/TinyMCE_Button_Step-_1-300x144.png 300w" sizes="(max-width: 654px) 100vw, 654px" /></a></p>
<pre lang="html4strict">
<td>
	<a title="advanced.mybutton_desc" onclick="return false;" onmousedown="return false;" class="mceButton mceButtonEnabled mce_mybutton" href="javascript:;" id="mce_0_mybutton">
		<span class="mceIcon mce_mybutton"></span>
	</a>
</td>
</pre>
<p>This name can be simply used in the CSS file (/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/ui.css) to style the button. Because TinyMCE uses sprite for its background images, you can copy/paste the style from some other button and than adjust the background position, only after you&#8217;ve added the new icon to the sprite. Here&#8217;s simply a copy of the style from another button:</p>
<pre lang="css">
...
.defaultSkin span.mce_numlist {background-position:-80px 0}
.defaultSkin span.mce_mybutton {background-position:-460px 0}
.defaultSkin span.mce_justifyleft {background-position:-460px 0}
...
</pre>
<p>You can see how the button appears in the control bar!</p>
<p><a href="/wp-content/uploads/2011/02/TinyMCE_Button_Step_2.png"><img class="aligncenter size-full wp-image-2209" title="TinyMCE_Button_Step_2" src="/wp-content/uploads/2011/02/TinyMCE_Button_Step_2.png" alt="TinyMCE Button Step 2" width="655" height="313" srcset="/wp-content/uploads/2011/02/TinyMCE_Button_Step_2.png 655w, /wp-content/uploads/2011/02/TinyMCE_Button_Step_2-300x143.png 300w" sizes="(max-width: 655px) 100vw, 655px" /></a></p>
<h2>Binding the Button</h2>
<p>The final job to do is to bind the button with some action. This thing happens again in /tinymce/jscripts/tiny_mce/themes/advanced/editor_template_src.js. You just have to search for other bindings &#8211; let&#8217;s say mceCleanup. There you can write your new function &#8211; myFunc:</p>
<pre lang="javascript">
FormatBlock : function(ui, val) {
	...
},

myFunc : function() {
	this.editor.selection.setContent('Hello World!');
},

mceCleanup : function() {
	...
},
</pre>
<p>Now after clicking the button the method will be executed. <a href="/wp-content/uploads/2011/02/TinyMCE_Button_Step_3.png"><img class="aligncenter size-full wp-image-2210" title="TinyMCE_Button_Step_3" src="/wp-content/uploads/2011/02/TinyMCE_Button_Step_3.png" alt="TinyMCE Button Step 3" width="653" height="312" srcset="/wp-content/uploads/2011/02/TinyMCE_Button_Step_3.png 653w, /wp-content/uploads/2011/02/TinyMCE_Button_Step_3-300x143.png 300w" sizes="(max-width: 653px) 100vw, 653px" /></a></p>
<p>Note that the name of the method should be exactly the same as described in the controls array in /tinymce/jscripts/tiny_mce/themes/advanced/editor_template_src.js. If not the button wont work ever.</p>
<h2>Final Steps</h2>
<p>Now you&#8217;ve to compress (if you wish) the js files and deploy your editor.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/02/17/adding-a-custom-button-to-tinymce-revised/" rel="bookmark" title="Adding a Custom Button to TinyMCE &#8211; REVISED">Adding a Custom Button to TinyMCE &#8211; REVISED </a></li>
<li><a href="/2010/01/31/speed-up-the-javascript-it-can-change-dramatically-the-user-experience/" rel="bookmark" title="Speed up the JavaScript. It can change dramatically the user experience.">Speed up the JavaScript. It can change dramatically the user experience. </a></li>
<li><a href="/2010/02/11/javascript-optimization-lazy-loading/" rel="bookmark" title="JavaScript optimization. Lazy loading.">JavaScript optimization. Lazy loading. </a></li>
<li><a href="/2011/04/05/jquery-unbind/" rel="bookmark" title="jQuery.unbind()">jQuery.unbind() </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2011/02/16/adding-a-custom-button-to-tinymce/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Some PHP Tips: basename()</title>
		<link>/2010/10/04/some-php-tips-basename/</link>
		<comments>/2010/10/04/some-php-tips-basename/#respond</comments>
		<pubDate>Mon, 04 Oct 2010 16:38:13 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[basename]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">/?p=2014</guid>
		<description><![CDATA[Here&#8217;s a quick tip: I&#8217;ve an absolute file path &#8220;/var/www/html/index.php&#8221;, but I need only the file name &#8211; index.php. So how do I get it? basename There it is: $filename = basename('/var/www/html/index.php'); now $filename contains only &#8220;index.php&#8221;!<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/07/29/php-strings-how-to-get-the-extension-of-a-file/" rel="bookmark" title="PHP Strings: How to Get the Extension of a File">PHP Strings: How to Get the Extension of a File </a></li>
<li><a href="/2010/09/10/automatically-upload-images-with-php-directly-from-the-uri/" rel="bookmark" title="Automatically Upload Images with PHP Directly from the URI">Automatically Upload Images with PHP Directly from the URI </a></li>
<li><a href="/2010/09/03/the-better-way-to-unset-variables-in-php/" rel="bookmark" title="The Better Way to Unset Variables in PHP">The Better Way to Unset Variables in PHP </a></li>
<li><a href="/2011/08/17/php-fetch-get-as-string-with-http_build_query/" rel="bookmark" title="PHP: Fetch $_GET as String with http_build_query()">PHP: Fetch $_GET as String with http_build_query() </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s a quick tip: I&#8217;ve an absolute file path &#8220;/var/www/html/index.php&#8221;, but I need only the file name &#8211; index.php. So how do I get it?</p>
<h2>basename</h2>
<p>There it is:</p>
<pre lang="php">
$filename = basename('/var/www/html/index.php');
</pre>
<p>now $filename contains only &#8220;index.php&#8221;!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/07/29/php-strings-how-to-get-the-extension-of-a-file/" rel="bookmark" title="PHP Strings: How to Get the Extension of a File">PHP Strings: How to Get the Extension of a File </a></li>
<li><a href="/2010/09/10/automatically-upload-images-with-php-directly-from-the-uri/" rel="bookmark" title="Automatically Upload Images with PHP Directly from the URI">Automatically Upload Images with PHP Directly from the URI </a></li>
<li><a href="/2010/09/03/the-better-way-to-unset-variables-in-php/" rel="bookmark" title="The Better Way to Unset Variables in PHP">The Better Way to Unset Variables in PHP </a></li>
<li><a href="/2011/08/17/php-fetch-get-as-string-with-http_build_query/" rel="bookmark" title="PHP: Fetch $_GET as String with http_build_query()">PHP: Fetch $_GET as String with http_build_query() </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/10/04/some-php-tips-basename/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2xjQuery: Select a Selector</title>
		<link>/2010/09/24/2xjquery-select-a-selector/</link>
		<comments>/2010/09/24/2xjquery-select-a-selector/#comments</comments>
		<pubDate>Fri, 24 Sep 2010 08:23:58 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Comparison of JavaScript frameworks]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[Ext]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript programming language]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery javascript library]]></category>
		<category><![CDATA[jquery selectors]]></category>
		<category><![CDATA[Markup languages]]></category>
		<category><![CDATA[openlayers]]></category>
		<category><![CDATA[openlayers library]]></category>
		<category><![CDATA[Span and div]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[World Wide Web]]></category>

		<guid isPermaLink="false">/?p=1989</guid>
		<description><![CDATA[Selectors in jQuery If you&#8217;re familiar with jQuery you should already know what are selectors and how they work. However we&#8217;re used to get some DOM element with a specific selector, but actually sometimes you cannot select directly what you need. This is especially true when mixing more than one JavaScript libraries. In my case &#8230; <a href="/2010/09/24/2xjquery-select-a-selector/" class="more-link">Continue reading <span class="screen-reader-text">2xjQuery: Select a Selector</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/01/08/jquery-vs-pure-javascript/" rel="bookmark" title="jQuery vs. pure JavaScript">jQuery vs. pure JavaScript </a></li>
<li><a href="/2009/07/29/cancel-bubbling-on-element-click-with-jquery/" rel="bookmark" title="cancel bubbling on element click with jQuery">cancel bubbling on element click with jQuery </a></li>
<li><a href="/2009/11/02/ajax-in-jquery/" rel="bookmark" title="$.ajax in jQuery">$.ajax in jQuery </a></li>
<li><a href="/2009/04/01/jquery-accessing-a-child-element/" rel="bookmark" title="jQuery &#8211; accessing a child element">jQuery &#8211; accessing a child element </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Selectors in jQuery</h2>
<p><a href="/wp-content/uploads/2010/09/jquery.png"><img class="alignleft size-full wp-image-1999" title="jquery" src="/wp-content/uploads/2010/09/jquery.png" alt="jQuery JavaScript Library" width="259" height="65" /></a></p>
<p>If you&#8217;re familiar with <a title="jQuery" href="http://jquery.com/" target="_blank">jQuery</a> you should already know what are selectors and how they work. However we&#8217;re used to get some DOM element with a specific selector, but actually sometimes you cannot select directly what you need. This is especially true when mixing more than one JavaScript libraries. In my case <a title="OpenLayers" href="http://openlayers.org/" target="_blank">OpenLayers</a> generated a vector layer and jQuery was supposed to change the vectors fill-color property.</p>
<p><a href="/wp-content/uploads/2010/09/openlayers.png"><img class="alignleft size-full wp-image-2000" title="openlayers" src="/wp-content/uploads/2010/09/openlayers.png" alt="OpenLayers" width="195" height="37" /></a></p>
<p>With the simple $(&#8216;path&#8217;) I easily got all vectors in the current document, but the problem was that I took them as text. Thus it came to me to use nested jQuery &#8211; $($(&#8216;selector&#8217;));</p>
<p>To describe what actually happened in my case, let me show you a breve example.</p>
<h2>Example</h2>
<p>Here&#8217;s a short HTML markup:</p>
<pre lang="html4strict">
<div><span>text text</span></div>

</pre>
<p>With jQuery I can select both the DIV and SPAN with the simple $(&#8216;div&#8217;) and $(&#8216;span&#8217;), but just for the example lets assume I&#8217;ve only the inner text of the DIV tag:</p>
<pre lang="javascript">$('div').html();
</pre>
<p>That was the case in the OpenLayers/jQuery problem. Now I can easily use another jQuery selector:</p>
<pre lang="javascript">$($('div').html());
</pre>
<p>This will return the same as $(&#8216;span&#8217;) &#8211; a jQuery object.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/01/08/jquery-vs-pure-javascript/" rel="bookmark" title="jQuery vs. pure JavaScript">jQuery vs. pure JavaScript </a></li>
<li><a href="/2009/07/29/cancel-bubbling-on-element-click-with-jquery/" rel="bookmark" title="cancel bubbling on element click with jQuery">cancel bubbling on element click with jQuery </a></li>
<li><a href="/2009/11/02/ajax-in-jquery/" rel="bookmark" title="$.ajax in jQuery">$.ajax in jQuery </a></li>
<li><a href="/2009/04/01/jquery-accessing-a-child-element/" rel="bookmark" title="jQuery &#8211; accessing a child element">jQuery &#8211; accessing a child element </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/09/24/2xjquery-select-a-selector/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<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>Beginning Algorithm Complexity and Estimation</title>
		<link>/2010/08/29/beginning-algorithm-complexity-and-estimation/</link>
		<comments>/2010/08/29/beginning-algorithm-complexity-and-estimation/#respond</comments>
		<pubDate>Sun, 29 Aug 2010 11:05:47 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[Analysis of algorithms]]></category>
		<category><![CDATA[Asymptotic analysis]]></category>
		<category><![CDATA[Big O notation]]></category>
		<category><![CDATA[C syntax]]></category>
		<category><![CDATA[complexity]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[Lenstra elliptic curve factorization]]></category>
		<category><![CDATA[Mathematical analysis]]></category>
		<category><![CDATA[Mathematical notation]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Negation]]></category>
		<category><![CDATA[programmer]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[Variable]]></category>

		<guid isPermaLink="false">/?p=1937</guid>
		<description><![CDATA[Which is the Fastest Program? When a programmer sees a chunk of code he tends to evaluate it in a rather intuitive manner and to qualify it as &#8220;elegant&#8221; or not. This is quite easy, because it&#8217;s subjective and nobody knows what exactly elegant means. However behind this there is a powerful mathematical approach of &#8230; <a href="/2010/08/29/beginning-algorithm-complexity-and-estimation/" class="more-link">Continue reading <span class="screen-reader-text">Beginning Algorithm Complexity and Estimation</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/09/03/friday-algorithms-input-data-and-complexity/" rel="bookmark" title="Friday Algorithms: Input Data and Complexity">Friday Algorithms: Input Data and Complexity </a></li>
<li><a href="/2010/10/03/using-php-array_diff-in-algorithm-development/" rel="bookmark" title="Using PHP&#8217;s array_diff in Algorithm Development">Using PHP&#8217;s array_diff in Algorithm Development </a></li>
<li><a href="/2011/11/04/how-to-check-if-a-date-is-more-or-less-than-a-month-ago-with-php/" rel="bookmark" title="How to Check if a Date is More or Less Than a Month Ago with PHP">How to Check if a Date is More or Less Than a Month Ago with PHP </a></li>
<li><a href="/2012/03/12/algorithm-cheatsheet-quicksort/" rel="bookmark" title="Algorithm cheatsheet: Quicksort">Algorithm cheatsheet: Quicksort </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Which is the Fastest Program?</h2>
<p><a href="/wp-content/uploads/2010/08/complexity.jpg"><img src="/wp-content/uploads/2010/08/complexity.jpg" alt="" title="circuit" width="430" height="213" class="aligncenter size-full wp-image-1949" srcset="/wp-content/uploads/2010/08/complexity.jpg 430w, /wp-content/uploads/2010/08/complexity-300x148.jpg 300w" sizes="(max-width: 430px) 100vw, 430px" /></a><br />
When a programmer sees a chunk of code he tends to evaluate it in a rather intuitive manner and to qualify it as &#8220;elegant&#8221; or not. This is quite easy, because it&#8217;s subjective and nobody knows what exactly elegant means. However behind this there is a powerful mathematical approach of measuring a program effectiveness.</p>
<p>It&#8217;s a pity that most of the developers still think of the big O notation as something from the university classes, but unusual in the practice and they barely use it their job. But before describing the big O notation, let me start from something really simple.</p>
<p>Let&#8217;s have the following example (note that all the examples are in PHP):</p>
<pre lang="php">
$n = 100;
$s = 0;

for ($i = 0; $i < $n; $i++) {
	for ($j = 0; $j < $n; $j++) {
		$s++;	
	}	
}
</pre>
<p>As you can see there are two assignments and two nested loops. This is really a widely used example from any algorithm book.</p>
<h2>Constants, Languages, Compilers</h2>
<p>First of all the time to assign a value to a variable, to compare two values and to increment a variable is constant. It depends on the computer resources, the compiler or the language, but it's constant on one machine if you compare two chunks of code. Now we can see that these operations take (add) constant time to the program, and we can assume this time is respectively a, b, c, d, e, f, g, h, i.</p>
<pre lang="php">
$n = 100; 	// a
$s = 0;		// b
$i = 0; 	// c
$i < $n; 	// d
$i++;		// e
$j = 0; 	// f
$j < $n;	// g
$j++;		// h
$s++;		// i
</pre>
<h2>What Matters?</h2>
<p>Actually the most important thing here is the value of n. By assigning greater values to n the more time will take the program to run. As we can see from the following table by multiplying the value of n by 10, the time became 100 times more.</p>
<pre lang="php">
n		time
10		0.00002
100		0.002
...		...
</pre>
<p>What happens in fact is that we can sum all these values.</p>
<pre lang="php">
a + b + c + n*d + n*e + n*(f + n*g + n*h + n*i)
</pre>
<p>and by substituting:</p>
<pre lang="php">
a + b + c = k
d + e + n = l
g + h + i = m
</pre>
<p>the result is:</p>
<pre lang="php">
m*n² + l*n + k
</pre>
<h2>Conclusion</h2>
<p>Here the most important thing is the degree of n, because it can change dramatically the program time consumption depending on the n value. Thus this chunk has a quadratic complexity or O(n²).</p>
<p>Of course there are constants, but in the practice they are not so important. Take a look at these two functions:</p>
<pre lang="php">
f = 2*n²
g = 200*n
</pre>
<p>OK, for n = 1 the first one will be faster, but as n increments the second function becomes to be faster and faster, thus after a given value of n the second function is really the fastest!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/09/03/friday-algorithms-input-data-and-complexity/" rel="bookmark" title="Friday Algorithms: Input Data and Complexity">Friday Algorithms: Input Data and Complexity </a></li>
<li><a href="/2010/10/03/using-php-array_diff-in-algorithm-development/" rel="bookmark" title="Using PHP&#8217;s array_diff in Algorithm Development">Using PHP&#8217;s array_diff in Algorithm Development </a></li>
<li><a href="/2011/11/04/how-to-check-if-a-date-is-more-or-less-than-a-month-ago-with-php/" rel="bookmark" title="How to Check if a Date is More or Less Than a Month Ago with PHP">How to Check if a Date is More or Less Than a Month Ago with PHP </a></li>
<li><a href="/2012/03/12/algorithm-cheatsheet-quicksort/" rel="bookmark" title="Algorithm cheatsheet: Quicksort">Algorithm cheatsheet: Quicksort </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/08/29/beginning-algorithm-complexity-and-estimation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
