This post is just one among the various rants available online that use a bad-mouth for PHP despite the fact that it is successfully used in various sites such as Facebook, wikipedias, etc

So here’s what got me thinking working on my GSoC project on SemanticMediaWiki (an extension for MediaWiki), I mistakenly deleted some text from a .php file which was a public variable of a class. I tested and found that things are working fine and committed my patch when looking at the diff I was amazed how things were working. Then I ran some tests

<?php
class hello{

	public function __construct($name){
		$this->name = $name;
	}
}

$wy = new hello('sdfs');
echo $wy->name;

to my amazement this worked perfectly even though I hadn’t initialized $name earlier. This definitely prevents some bugs, but then I prefer bugs than unmanageable code.

Advertisements