Differences between PHP and C#

I figured I’d create a list of differences between PHP and C# in case I (or someone else)  ever need a reference. I’m sure there are a lot of those difference, but I’m going to add the ones that struck me as the most obvious ones, and the ones that one needs to remember when switching from PHP to C#. You can add yours in the comments.

  • Function names don’t have a “function” in the declaration as in PHP
  • In C# classes are implemented (derived) with a : instead of the “implements” declaration
  • Class constructors in C# have the same name as the class…much like PHP 4 used to be, if I remember correctly
  • To run the code in the parent constructor, C# uses :base() right after the child class constructor declaration (public ChildClass :base() {})
  • All variables, data sets and objects need to have a type declared – after all C# is a strongly typed language

To be continued…

4 Comments to “Differences between PHP and C#”

  1. By Kevin Korb, November 19, 2009 @ 10:44 am

    PHP’s Arrarys are awesome and flexible. In C# you might be using an array, ArrayList, Hashtable, DataTable, or another collection.

  2. By Kevin Korb, March 3, 2010 @ 6:33 pm

    PHP is awesome! C# is a Microsoft Language.

  3. By Steve, May 28, 2010 @ 6:09 am

    […] continue on the differences between PHP and C# theme, here’s a list of most striking differences between MySQL and MS […]

  • Differences between MySQL and MS SQL | Raivo Ratsep — November 24, 2009 @ 11:31 pm

  • RSS feed for comments on this post. TrackBack URI

    Leave a Reply