<?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>Michael De Wildt &#187; PHP</title>
	<atom:link href="http://www.mikeyd.com.au/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mikeyd.com.au</link>
	<description>An uber nerd rambling about open source, PHP, Python and whatever I find interesting</description>
	<lastBuildDate>Wed, 04 Jan 2012 22:36:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Setting the maximum execution time when PHP is running in safe mode</title>
		<link>http://www.mikeyd.com.au/2011/05/24/setting-the-maximum-execution-time-when-php-is-running-in-safe-mode/</link>
		<comments>http://www.mikeyd.com.au/2011/05/24/setting-the-maximum-execution-time-when-php-is-running-in-safe-mode/#comments</comments>
		<pubDate>Tue, 24 May 2011 12:06:00 +0000</pubDate>
		<dc:creator>Mikey</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress Backup to Dropbox]]></category>

		<guid isPermaLink="false">http://www.mikeyd.com.au/?p=456</guid>
		<description><![CDATA[Many php applications, like WordPress Backup to Dropbox, require an extended max execution time PHP setting in order to complete a task. By default this setting is set to 30 seconds and, in the case of my WordPress plugin, is not enough for a backup to be completed. If the PHP installation was not compiled [...]]]></description>
			<content:encoded><![CDATA[<p>Many php applications, like WordPress Backup to Dropbox, require an extended max execution time PHP setting in order to complete a task. By default this setting is set to 30 seconds and, in the case of my WordPress plugin, is not enough for a backup to be completed.</p>
<p>If the PHP installation was not compiled in safe mode then we can change this value within the application using <a href="http://php.net/manual/en/function.set-time-limit.php">set_time_limit</a>. So for any long running scripts setting the time limit to zero will tell PHP to allow the script to run forever.</p>
<p>However if your PHP installation is running in <a href="http://php.net/manual/en/features.safe-mode.php">safe mode</a>, this function is blocked and there is no way of altering the time limit from within the application. Therefore the only way to get the an application to complete its task the php.ini max_execution_time setting will need to be altered. In the case of WordPress Backup to Dropbox this setting needs to be set to at least 3600 seconds  (1 hour).</p>
<p>How easily this value can be changes depends on how your hosts PHP installation is configured. If your host allows it you can put a file named php.ini inside the root of your WordPress installation with the max_execution_time set.</p>
<pre style="brush: sh;">max_execution_time = 0</pre>
<p>If this does not work then you have to edit the value in your php.ini file. The location of this file depends on your operating system and a quick Google search will yield plenty of literature on how this is done.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeyd.com.au/2011/05/24/setting-the-maximum-execution-time-when-php-is-running-in-safe-mode/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>How to use PHP&#8217;s ReflectionClass to test private methods and properties with PHPUnit</title>
		<link>http://www.mikeyd.com.au/2011/01/20/how-to-use-phps-reflectionclass-to-test-private-methods-and-properties-with-phpunit/</link>
		<comments>http://www.mikeyd.com.au/2011/01/20/how-to-use-phps-reflectionclass-to-test-private-methods-and-properties-with-phpunit/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 23:56:24 +0000</pubDate>
		<dc:creator>Mikey</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[PHPUnit]]></category>
		<category><![CDATA[Reflection]]></category>

		<guid isPermaLink="false">http://www.mikeyd.com.au/?p=327</guid>
		<description><![CDATA[The other day I stumbled across PHP&#8217;s ReflectionClass that is available in version 5.3.2 or newer. It is a fantastic tool that allows you to grab information about a class and, in turn, any of its runtime objects. So, when you couple it with with PHPUnit you can easily use it to test private and [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I stumbled across PHP&#8217;s <a href="http://www.php.net/manual/en/class.reflectionclass.php">ReflectionClass</a> that is available in version 5.3.2 or newer. It is a fantastic tool that allows you to grab information about a class and, in turn, any of its runtime objects. So, when you couple it with with PHPUnit you can easily use it to test private and protected methods and functions of any class.</p>
<p>Up until now, I have always found this to be a predicament in any programming language. You have a lovely class that follows all the rules of object oreiented programming, including encapsualtion and information hiding, that only exposes a small number of methods to the public. In many cases, to keep your code <a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself">DRY</a>, these public methods rely on private methods to perform task that is very specific to the class and is of no use in the public domain.</p>
<p>So, how do you individually test these private methods of your class without making them public? Well as you may have guessed&#8230; PHP&#8217;s <a href="http://www.php.net/manual/en/class.reflectionclass.php">ReflectionClass</a> is one way of doing so!</p>
<p>The class below is good example, it has the public method validateData that relies on functionality of the constructor, where the incoming data is sorted, and the checkValue method, that ensures that the is a number between 5 and 10.</p>
<pre class="brush:php">class Foo {

	private $data = array();

	/**
	 * Creates a new Foo object by taking an array of items
	 * and sorting it before setting the data property
	 * @param  $data
	 */
	function __construct($data) {
		sort($data);
		$this->data = $data;
	}

	/**
	 * Checks whether a value is between 5 and 10
	 * @param  $value
	 * @return bool
	 */
	private function checkValue($value) {
		if ($value &#038;&#038; $value > 5 &#038;&#038; $value < 10) {
			return true;
		}
		return false;
	}

	/**
	 * Validates the data of this class's data to ensure that all
	 * its values are sorted and between 5 and 10
	 * @return bool
	 */
	public function validateData() {
		$is_valid = true;
		$prev_value = 0;
		foreach ($this->data as $value) {
			if (!$this->checkValue($value) || $prev_value > $value) {
				$is_valid = false;
				break;
			}
			$prev_value = $value;
		}
		return $is_valid;
	}
}</pre>
<p>Finally the PHPUnit class below is a comprehensive set of tests for the above class, it uses the <a href="http://www.php.net/manual/en/class.reflectionclass.php">ReflectionClass</a> in each of our tests: </p>
<ul>
<li>To verify that our constructor is correctly sorting the incoming array by extracting the private class property &#8216;data&#8217; and checking that it is, in fact, sorted.</li>
<li>To test the private checkValue method to make sure that it conforms to our rules</li>
<li>Finally, to test the validateData method with an invalid (not sorted) array to verify it correctly returns false</li>
</ul>
<pre class="brush:php">class DataTest extends PHPUnit_Framework_TestCase {

	/**
	 * Foo::$data is private so lets php reflection
	 * class to test it
	 * @return void
	 */
	public function testConstructor() {
		//First we need to create a ReflectionClass object
		//passing in the class name as a variable
		$reflection_class = new ReflectionClass("Foo");

		//Then we need to get the property we wish to test
		//and make it accessible
		$property = $reflection_class-&gt;getProperty('data');
		$property-&gt;setAccessible(true);

		//We need to create an empty object to pass to
		//ReflectionProperty's getValue method
		$foo = new Foo(array(7, 6, 8));

		$this-&gt;assertEquals(array(6, 7, 8), $property-&gt;getValue($foo));
	}

	/**
	 * Foo::checkValue is private so lets php reflection
	 * class to test it
	 * @return void
	 */
	public function testCheckValue()
    {
		$reflection_class = new ReflectionClass("Foo");

		//Then we need to get the method we wish to test and
		//make it accessible
		$method = $reflection_class-&gt;getMethod("checkValue");
		$method-&gt;setAccessible(true);

		//We need to create an empty object to pass to
		//ReflectionMethod invoke method followed by our
		//test parameters
		$foo = new Foo(null);

		//Boundary test - False expected
		$this-&gt;assertFalse($method-&gt;invoke($foo, 5));

		//Good data - True Expected
		$this-&gt;assertTrue($method-&gt;invoke($foo, 7));
    }

	/**
	 * validateData relies on checkValue and the constructor.
	 * So now that, from the tests above we know that these two
	 * work as expected we can test it!
	 * @return void
	 */
    public function testValidateData()
    {
		$foo = new Foo(array(6, 7, 8 ,9));
		$this-&gt;assertTrue($foo-&gt;validateData());

		$foo = new Foo(array(10));
		$this-&gt;assertFalse($foo-&gt;validateData());

		//We may also want to test to confirm our rule that
		//the array must be sorted here.

		$reflection_class = new ReflectionClass("Foo");

		//Then we need to get the property we wish to modify,
		//set it to accessible and then override its value
		//with an invalid one
		$property = $reflection_class-&gt;getProperty('data');
		$property-&gt;setAccessible(true);
		$property-&gt;setValue($foo, array(7, 9, 8));

		$this-&gt;assertFalse($foo-&gt;validateData());
    }
}</pre>
<p>Now because each individual method is tested you can easily pinpoint any errors that may be introduced as the code evolves. Obviously this is overkill for a simple class like this, however, you may have more complicated private methods that provide some crucial functionality to a public method that should be individially tested.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeyd.com.au/2011/01/20/how-to-use-phps-reflectionclass-to-test-private-methods-and-properties-with-phpunit/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Cross browser PHP drop down menu generator powered by JQuery and CSS.</title>
		<link>http://www.mikeyd.com.au/2010/05/15/cross-browser-php-drop-down-menu-generator-powered-by-jquery-and-css/</link>
		<comments>http://www.mikeyd.com.au/2010/05/15/cross-browser-php-drop-down-menu-generator-powered-by-jquery-and-css/#comments</comments>
		<pubDate>Sat, 15 May 2010 06:49:26 +0000</pubDate>
		<dc:creator>Mikey</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.mikeyd.com.au/?p=150</guid>
		<description><![CDATA[I needed to create a drop down menu that supported all the major browsers that was generated with dynamic content. So I decided to use the tried and true unordered HTML list approach. This approach can be easily controlled with pure CSS in browsers like Chrome and Firefox, however, other browsers such as Internet Explorer [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to create a drop down menu that supported all the major browsers that was generated with dynamic content. So I decided to use the tried and true unordered HTML list approach. This approach can be easily controlled with pure CSS in browsers like Chrome and Firefox, however, other browsers such as Internet Explorer cause issues so JQuery is required to force compliance across multiple platforms and browsers.</p>
<p>First I created this neat little class that can be used to create an object model of MenuItems that can be later serialized into a HTML unordered list. This model is basically a linked list of MenuItems where the serialize function just iterates through each object and its children converting its properties into a string.</p>
<pre class="brush:php">class MenuItem {

    private $name;
    private $url;
    private $level;
    private $items;

    public function __construct($item_name, $item_lvl, $item_url = "#") {
        $this-&gt;name = $item_name;
        $this-&gt;url = $item_url;
        $this-&gt;level = $item_lvl;
        $this-&gt;items = array();
    }

    public function add_item(MenuItem $menu_item) {
        $this-&gt;items[] = $menu_item;
    }

    public function serialize() {
	$html = "";

        if ($this-&gt;level == 0) {
            $html = "&lt;ul class=\"menu\"&gt;\n";
        }

        if (!empty($this-&gt;items)) {
            $html .= "&lt;li class=\"{$this-&gt;get_class()} menu_arrow\"&gt;";
        } else {
            $html .= "&lt;li class=\"{$this-&gt;get_class()}\"&gt;";
        }

        $html .= "&lt;a href=\"$this-&gt;url\"&gt;$this-&gt;name";

        if (!empty($this-&gt;items)) {
            $html .= "&lt;/a&gt;\n&lt;ul class=\"{$this-&gt;get_class()}_block\"&gt;\n";
            foreach ($this-&gt;items as $menu_item) {
                $html .= $menu_item-&gt;serialize();
            }
            $html .= "&lt;/ul&gt;\n";
        } else {
            $html .= "&lt;/a&gt;";
        }

        $html .= "&lt;/li&gt;\n";

        if ($this-&gt;level == 0) {
            $html .= "&lt;/ul&gt;\n";
        }

        return $html;
    }

    private function get_class() {
        switch ($this-&gt;level) {
            case 0:
                $class = "level_zero";
                break;
            case 1:
                $class = "level_one";
                break;
            case 2:
                $class = "level_two";
                break;
        }
        return $class;
    }
}</pre>
<p>This class makes it very easy to dynamically generate a multi tiered menu. All you have to do is create your base items and add them to the MenuItem that they belong too.</p>
<pre class="brush:php">$search_links = new MenuItem("Search", 1);
$search_links-&gt;add_item(
        new MenuItem("Google", 2, "http://www.google.com")
);
$search_links-&gt;add_item(
        new MenuItem("Yahoo", 2, "http://www.yahoo.com")
);

$social_links = new MenuItem("Social", 1);
$social_links-&gt;add_item(
        new MenuItem("Facebook", 2, "http://www.facebook.com")
);
$social_links-&gt;add_item(
        new MenuItem("Twitter", 2, "http://www.twitter.com")
);

$menu = new MenuItem("Links", 0);
$menu-&gt;add_item($search_links);
$menu-&gt;add_item($social_links);

echo $menu-&gt;serialize();</pre>
<p>The code above generates the unordered list below which, as mentioned before, can be controlled with pure CSS in the newer standards compliant browsers.</p>
<pre class="brush: xml;">
&lt;ul class=&quot;menu&quot;&gt;
&lt;li class=&quot;level_zero menu_arrow&quot;&gt;&lt;a href=&quot;#&quot;&gt;Links&lt;/a&gt;
&lt;ul class=&quot;level_zero_block&quot;&gt;
&lt;li class=&quot;level_one menu_arrow&quot;&gt;&lt;a href=&quot;#&quot;&gt;Search&lt;/a&gt;
&lt;ul class=&quot;level_one_block&quot;&gt;
&lt;li class=&quot;level_two&quot;&gt;&lt;a href=&quot;http://www.google.com&quot;&gt;Google&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;level_two&quot;&gt;&lt;a href=&quot;http://www.yahoo.com&quot;&gt;Yahoo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level_one menu_arrow&quot;&gt;&lt;a href=&quot;#&quot;&gt;Social&lt;/a&gt;
&lt;ul class=&quot;level_one_block&quot;&gt;
&lt;li class=&quot;level_two&quot;&gt;&lt;a href=&quot;http://www.facebook.com&quot;&gt;Facebook&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;level_two&quot;&gt;&lt;a href=&quot;http://www.twitter.com&quot;&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>The list above is controlled with the tiniest amount of CSS below. Of course the nicer you wan&#8217;t your menu to look the more CSS you will need to throw in! </p>
<pre class="brush:css">
ul.menu li ul {
	display: none;
}
</pre>
<p>The JQuery code I used to control the above menu is larger then it needs to be in order to make the menu support most browsers and operating systems. Many of the hacks in the script is to force Internet Explorer 6/7 to conform to the likes of Chrome and Firefox. Only the min width value needs to be set here to get your menu pop outs positioned correctly.</p>
<pre class="brush: jscript;">/* IE does not support min-width so we can get it with js since we are
 * already iterating through the items to display them.
 */
function setMinWidth(element) {
	if (element.width() &lt; 150) {
		element.css('width', '150px')
	}
}

/* IE positoning is kinda random compared to FF, Chrome and Safari so
 * this is to force it to conform.
 */
function positionPopout(element, top) {
	element.css('display', 'block');
	element.css('top', top + "px");
	setMinWidth(element);
}

$(document).ready(function() {
	$('li.level_zero').hover(
		function() {
			var element = $('ul.level_zero_block', this);
			var top = $(this).offset().top + $(this).height();

			//Fix IE left
			element.css('left', ($(this).position().left + 2) + "px");
			positionPopout(element, top);
		},
		function() {
			$('ul.level_zero_block', this).css('display', 'none');
		}
	);

	$('li.level_one').hover(
		function() {
			var element = $('ul.level_one_block', this);
			var top = $(this).offset().top -  + $(this).height();

			positionPopout(element, top);
			setMinWidth(element);
		},
		function() {
			$('ul.level_one_block', this).css('display', 'none');
		}
	);

	$('li.level_two').hover(
		function() {
			var element = $('ul.level_two_block', this);
			var top = $(this).offset().top - ($(this).height() * 2);

			positionPopout(element, top);
			setMinWidth(element);
		},
		function() {
			$('ul.level_two_block', this).css('display', 'none');
		}
	);
});</pre>
<p>This way of providing a drop down menu for your website is not a new idea, however I think using the MenuItem class is an elegant and easy way of dynamically generating this style of menu.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeyd.com.au/2010/05/15/cross-browser-php-drop-down-menu-generator-powered-by-jquery-and-css/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>C# to PHP &#8211; Translating my string to object to string C# solution</title>
		<link>http://www.mikeyd.com.au/2010/03/26/c-to-php-translating-my-string-to-object-to-string-c-solution/</link>
		<comments>http://www.mikeyd.com.au/2010/03/26/c-to-php-translating-my-string-to-object-to-string-c-solution/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 00:04:44 +0000</pubDate>
		<dc:creator>Mikey</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Dynamic Functions]]></category>
		<category><![CDATA[Late Static Binding]]></category>

		<guid isPermaLink="false">http://www.mikeyd.com.au/?p=93</guid>
		<description><![CDATA[Early this year I changed jobs where my new workplace uses PHP as its language of choice. As a academic excise I decided to translate the string to object back to string C# code I did here into PHP. I am very impressed in how easy it was to write in PHP! Instead of using [...]]]></description>
			<content:encoded><![CDATA[<p>Early this year I changed jobs where my new workplace uses PHP as its language of choice. As a academic excise I decided to translate the string to object back to string C# code I did <a href="http://www.mikeyd.com.au/?p=15">here</a> into PHP.</p>
<p>I am very impressed in how easy it was to write in PHP! Instead of using class and method attributes like I did in the C# solution, I wrote a base class to store this functionality. Therefore any class that I want to collapse into a string or be built into a model should inherit this class.</p>
<p>What I really like about PHP over C# is the ability to dynamically build function calls and even object declaration. You can see below that get_input_string and get_array use these language features respectively. This makes it really easy to write code that deals with anonymous classes and objects.</p>
<p>Here is my Template class which provides similar functionality to my static method extensions I wrote in C# <a href="../?p=15">here</a>.</p>
<pre class="brush:php">class Template {
    private $InputTemplate;
    private $OutputCounterLen;
    private $ArgArray = array();

    public function __construct($argArray, $input_Template, $output_counter_len) {
        $this-&gt;InputTemplate = $input_Template;
        $this-&gt;ArgArray = $argArray;
        $this-&gt;OutputCounterLen = $output_counter_len;
    }

    public function get_input_string() {
        $template = $this-&gt;InputTemplate;
        foreach ($this-&gt;ArgArray as $key =&gt; $argument) {
            $func = "get_$key";
            $val = $this-&gt;$func();
            if (strlen($val) &gt; $argument['len']) {
                throw new Exception("Too Long!");
            }
            if (!preg_match($argument['regex'], $val)) {
                throw new Exception("Regex missmatch!");
            }
            $template = str_replace("{".$key."}", $val, $template);
        }
        return $template;
    }

    public function get_array($str) {
        $count = substr($str, 0, $this-&gt;OutputCounterLen);
        $str = substr_replace($str, "", 0, $this-&gt;OutputCounterLen);
        $arr = array();
        for ($i = 0; $i &lt; $count; $i++) {
                $class = get_class($this);
                $obj = new $class();
                foreach ($this-&gt;ArgArray as $key =&gt; $value) {
                    $val = substr($str, 0, $this-&gt;ArgArray[$key]['len']);
                    $func = "set_$key";
                    $obj-&gt;$func(trim($val));
                    $str = substr_replace($str, "", 0, $this-&gt;ArgArray[$key]['len']);
            }
            $arr[] = $obj;
        }
        return $arr;
    }
}</pre>
<p>Now I have a Template base class that can build a string using the objects variables based on its assigned template. Below is a class the inherits the above template and and declares the maximum length and regular expression constraints of each of the classes properties. I think this part is done more elegantly in my C# solution <a href="../?p=15">here</a> because you can clearly see what constraints apply to the property because they are grouped together. As far as I know PHP does not have this functionality so I had to declare these constraints in an array in the constructor of the class.</p>
<p>Note: Each property must have a getter and a setter to work with the Template functions. I do miss the &#8220;{ get; set; }&#8221; of C# here.</p>
<pre class="brush:php">class Foo extends Template {
    private $Bar;
    private $Baz;

    public function __construct($bar = "", $baz = "") {
        $this-&gt;Bar = $bar;
        $this-&gt;Baz = $baz;

        $argArray['bar'] = array('regex' =&gt; "/^[a-zA-Z\s]+$/", 'len' =&gt; 10);
        $argArray['baz'] = array('regex' =&gt; "/^[a-zA-Z\s]+$/", 'len' =&gt; 10);
        parent::__construct($argArray, "{bar} {baz}", 2);
    }

    public function get_bar() {
        return $this-&gt;Bar;
    }

    public function get_baz() {
        return $this-&gt;Baz;
    }

    public function set_bar($val) {
        return $this-&gt;Bar = $val;
    }

    public function set_baz($val) {
        return $this-&gt;Baz = $val;
    }
}</pre>
<p>Finally to get your string based on the properties of Foo all you need to do is call get_input_string. The echo will print &#8220;Hello World&#8221; which is based on the template string &#8220;{bar} {baz}&#8221; declared in class Foo&#8217;s constructor.</p>
<pre class="code">$fooObj = new Foo("Hello", "World")
echo $fooObj-&gt;get_input_string(); //Will print "Hello World"</pre>
<p>Also, to get an array of Foo objects from a string passed to to the get_array_method you can use the following. Sadly, this means you need to create a redundant Foo object in order to call get_array. Using PHP 5.3 I could make a static method and use the new late static binding function to get the class name, however I would also need a way of statically declaring the ArgArray containing the property constraints. So this will do for now.</p>
<pre class="brush:php">$arr = $fooObj-&gt;get_array("3 One 1     One 2     Two 1     Two 2     Three 1    Three 2    ");

echo $arr[0]-&gt;get_bar(); //Will print "One 1"
echo $arr[0]-&gt;get_baz(); //Will print "One 2"

echo $arr[1]-&gt;get_bar(); //Will print "Two 1"
echo $arr[1]-&gt;get_baz(); //Will print "Two 2"

echo $arr[2]-&gt;get_bar(); //Will print "Three 1"
echo $arr[2]-&gt;get_baz(); //Will print "Three 2"</pre>
<p>As you can see the above PHP solution is written in significantly less lines of  code then its C# counterpart. There are some parts of the C# solution a prefer over the PHP solution, namely the class and method attributes. However I have to say overall I prefer my PHP solution. To be idiomatic I had to change the PHP solution quite a bit. I reckon I could take the same approach in C# and it will yield less code then the original however I still thing the PHP solution will surpass!</p>
<p>Oh and this post is in no way saying that PHP is better then C# all the time! I just think in this particular case it was easier and, in my opinion, a better solution in PHP.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeyd.com.au/2010/03/26/c-to-php-translating-my-string-to-object-to-string-c-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

