PHP...
Background
As a bit of background, for the last couple of months I've been doing some work for a personal client aside from the work for
Seismic Technologies which is on the back burner till we pick up some more investment interest (I'm still the lead dev though) - the project is an add-in for an existing product (COM interop) which be must be deeply-integrated, as well as being capable of being used in stand alone mode...
It's a very advantageous project considering the time frame, but that's part of the fun :) Once the clients moved forward on some marketing I'll post a little more about some of the challenges I've faced along the way.
At any rate - the project's stalled briefly while the clients doing a little business analysis to get the underlying methodology sorted - so they've asked me to switch across to building the license generation / customer portal / license purchasing module for their preexisting CMS system (CMS made simple - PHP) ... where are the ruby or Monorail CMS's to wean my clients onto?
PHP... ack
... So I haven't used PHP in anger for years and years, but the one advantage of dynamic languages is you can generally hit the ground running a lot quicker then their statically compiled competitors... maybe PHP even more so because it's focused on web development.So far the two things that have bugged/puzzled me are:
- Classes don't call their base classes default constructor implicity - you have to do that yourself. This isn't all bad, at least you can control when the default constructor is called.
- Methods are instance, static and pseudo-instance all in one...
Maybe I'm just old fashioned and there's nothing wrong with this, I should have a flick through Programming Language Pragmatics again, there must be some other dynamic languages with similar behavior?
At any rate, the example:
class A
{
function foo()
{
if (isset($this)) {
echo '$this is defined (';
echo get_class($this);
echo ")n";
} else {
echo "$this is not defined.n";
}
}
}class B
{
function bar()
{
A::foo();
}
}$a = new A();
$a->foo();
A::foo();
$b = new B();
$b->bar();
B::bar();
And the output of that little example is shown below, notice how A:foo() knew it was being called from class
B... I wonder what phalanger is doing under the hood to achieve the same thing in the CLR...
$this is defined (a)
$this is not defined.
$this is defined (b)
$this is not defined.