There are certain things that people tend to get used to and feel disappointed when they are missing. If you have ever driven the car with proverbial “meat grinders” instead of power windows, you know what I’m referring to. It’s pretty much the same thing with development tools.
The most trivial example will be:
<?php
class tst
{
public $first;
public $last;
}
$tstClass = new tst();
$tstClass->first = 567;
$tstClass->blast = 98;
echo ($tstClass->first + $tstClass->last);
?>
What happens here is quite obvious, however don’t expect PHP to warn you – it just runs.
The other code that just runs in PHP is this:
<?php
$tstArr = Array();
$tstArr[0] = 0;
$tstArr[1] = 1;
$tstArr[2] = 2;
$tstArr[3] = 3;
for($i=0;;$i++)
echo("tstArr[".$i."]=".$tstArr[$i]."<br /><br />");
?>
If you’re doing something similar in C#, the code won’t compile in the first example and will throw the exception in the second one.
These are just examples of what to watch out for when you switch to PHP from C#.
Tags: Asp.Net, PHP, Software Development
Hey, it’s a scripting language, meant for rapid prototyping using the old “worse is better” and “do what i mean” approaches. PHP/Perl people think this is a feature. You’ve got a case of engineer’s “build it right”-itis
Well, there are tons of enterprise sites build with PHP. So I think whoever uses it should be at least aware
Code formatting helps too, even in a blog ;]
Yes sir, will look into this!
Oh, don’t get me wrong, I *like* PHP lots. TONS of major sites use it (including our friendly Facebook), but I thought you were griping about how much less strict it is than “real” languages. It’s clumsy, inconsistent, very imperfect stuff, but it somehow gets the job done. Continued success in your climb up the learning curve (i’m sure you’ll crest it in no time–then you can teach me some stuff!)
Well, they say:”with power comes a great responsibility”. And I guess during the last few years I just got a little bit spoiled by C# and it’s IDE (Visual Studio)…