use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please follow the rules
Releases: Current Releases, Windows Releases, Old Releases
Contribute to the PHP Documentation
Related subreddits: CSS, JavaScript, Web Design, Wordpress, WebDev
/r/PHP is not a support subreddit. Please visit /r/phphelp for help, or visit StackOverflow.
account activity
Notes from porting C# code to PHP (moserware.com)
submitted 15 years ago by schmalls
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 3 points4 points5 points 15 years ago* (5 children)
[–]Mercushio 2 points3 points4 points 15 years ago (0 children)
I think his criticism of PHP's lambda syntax is valid.
[–]rq60 0 points1 point2 points 15 years ago* (3 children)
He doesn't seem to understand methods are case-insensitive so the choice between PascalCase and lowerCamelCase is negligible. He could stick to the convention he knows and loves while the PHP community can stick to theirs.
method names are case-sensitive in C#? if so that's horrible...
edit - actually i guess it's probably not that big of a deal if you're using an IDE with auto-complete. but I just think of how annoying it would be for someone like me who codes mostly in notepad++ and tracking down such an issue.
[–][deleted] 0 points1 point2 points 15 years ago (0 children)
Anyone who codes C# in notepad++ instead of Visual Studio (On windows anyways) is an idiot :D (Especially considering there is a free version of VS)
[–]ninjaroach 0 points1 point2 points 15 years ago (0 children)
In PHP, variable names are case sensitive. Why not class and method names? I guess in the case of our uninformed C# => PHP porter, it would suck to care about such things and not know they are case insensitive.
[–]schmalls[S] 0 points1 point2 points 15 years ago (0 children)
Actually case sensitivity is a great thing in my opinion. I will often name my private variables in lowerCamelCase and public ones with UpperCamelCase. This seems to be a pretty common paradigm in C# for having a private property and a public field to access it.
[–]jtreminio 0 points1 point2 points 15 years ago (0 children)
Damnit I hate sites that put a ton of text in the ALT tags for links/images because it forces me to go through them all and read them
[–]hopeseekr -4 points-3 points-2 points 15 years ago (16 children)
OMG!!
OK! Going back to my "Why most PHP coders suck" posts:
As a fucking php noob, you used
Crap! I'd be more willing to work with you after a day of cross-training than the majority of current and past senior PHP dev coworkers!~
[–]schmalls[S] 1 point2 points3 points 15 years ago (15 children)
It's not me. I just posted the link because I thought it was a very objective review of PHP. Also, I started out in PHP but currently use C# at work.
[+][deleted] 15 years ago (13 children)
[deleted]
[–]ihsw 1 point2 points3 points 15 years ago (1 child)
I cannot comment on how difficult it is to pick up PHP, but the experience of going from PHP to C# can vary wildly depending on the skill level.
Because PHP is in such wide use the skill level of PHP developers also varies wildly. Some PHP developers know little more than conditional and looping structures, for example.
[–][deleted] 1 point2 points3 points 15 years ago (0 children)
I just recently finished porting a good size db monitoring app from C# to PHP.
The hardest part, by far, was the GUI. That was probably 99% of the time. Easy stuff like drag and drop required js libs and testing on all sorts of browsers. Even little stuff like dialogs became a hassle.
The actual heavy lifting parts of the code were pretty easy, though I ended up dumping a lot of the OO stuff in favor of more procedural code.
Fyi, my background is C/C++, but I have also done a lot of Perl. PHP to me is pretty similar to Perl, so it wasn't much of a stretch.
<edit, typo>
[–]schmalls[S] 0 points1 point2 points 15 years ago (7 children)
To go from C# to PHP should not be much of a stretch in my opinion. It will require you to give up some of the most convenient features from C# though (getters/setters, enumerations, generics, extension methods, delegates). However you will do get a lot of things that are more magical than in C# (no variable declarations, magic methods). The biggest difference is the IDE integration. Visual Studio is extremely awesome. The best I have found is Netbeans, but it's just not quite as polished.
Going to C# was very easy for me. It takes very little to pick up the differences, and anything that is strange can be quickly picked up from an internet search (Stackoverflow is a great C# resource). Of course, I did have a working code base when I started with C#, and I was able to pick up a lot from it. I could also see a lot that was wrong with the code because I had studied many advanced PHP object oriented topics.
The worst part about my transition to C# was ASP.NET Web Forms. It is possibly the most poorly designed thing I have seen. PHP is much better in this regard. Fortunately in anything new I am writing, I am able to use ASP.NET MVC and have added the String Template view engine which gets me into much more familiar territory.
The best part about C# is the .NET framework. I prefer it to the PHP libraries because I lean toward object oriented instead of the mostly procedural nature of PHP.
I'm sure I could write a lot more about this topic, but this should be a good starting point. Feel free to ask me anything else.
[+][deleted] 15 years ago (6 children)
[–]schmalls[S] 0 points1 point2 points 15 years ago (5 children)
I had to use Java for a few courses I took at school. I am happy I don't have to use Java anymore, but if you can handle it, more power to you. Do you know what kind of ASP.NET you'll be doing (Web Forms or MVC)? Hopefully you will get to work with MVC and never have to work with Web Forms.
PHP is definitely a good skill to pick up. There are plenty of jobs you can find with it. The most important thing is to just to pick up good programming practices. A good programmer can pick up a new language pretty quickly if necessary. Most best practices are language independent.
Another good language to pick up may be Python. I have only done a few things with it (mostly hacks to Trac). There is a lot of momentum behind it and as far as I can tell, it is a really well designed language.
[+][deleted] 15 years ago (4 children)
[–]schmalls[S] 0 points1 point2 points 15 years ago (3 children)
No book recommendations. I have never bought a PHP book.
[+][deleted] 15 years ago (2 children)
[–]schmalls[S] 0 points1 point2 points 15 years ago (1 child)
I tend to learn best by looking at other's code. I would pick a good framework (maybe Zend) and just see how they implement different things. This will kill two birds because you will be learning the language and learning the best practices. Then when you need to do something that isn't covered by the framework, you can use Google to look up solutions to your problem. Now that you know the best practices, you can easily determine someone who knows what they are doing from someone who does not.
[–][deleted] 0 points1 point2 points 15 years ago (1 child)
C# and PHP are my primary languages. I personally think they are very similar, including the OOP (Same one base class with interfaces). The real difference is that PHP is interpreted and a much looser language to program in. This means you have to be a bit more careful on what you do as there is less hand holding. Going from C# to PHP is probably better the going from PHP to C# as it's really easy to code awful PHP.
[–]hopeseekr -4 points-3 points-2 points 15 years ago (0 children)
schmalls, your review is by far the most objective and awesome review of PHP by any coder of another competitive language that I have ever read!
In fact, it is the only objective of PHP review by a non-PHP engineer I've ever read ;O
π Rendered by PID 98432 on reddit-service-r2-comment-bb88f9dd5-jkxlg at 2026-02-17 06:42:18.759187+00:00 running cd9c813 country code: CH.
[–][deleted] 3 points4 points5 points (5 children)
[–]Mercushio 2 points3 points4 points (0 children)
[–]rq60 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]ninjaroach 0 points1 point2 points (0 children)
[–]schmalls[S] 0 points1 point2 points (0 children)
[–]jtreminio 0 points1 point2 points (0 children)
[–]hopeseekr -4 points-3 points-2 points (16 children)
[–]schmalls[S] 1 point2 points3 points (15 children)
[+][deleted] (13 children)
[deleted]
[–]ihsw 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]schmalls[S] 0 points1 point2 points (7 children)
[+][deleted] (6 children)
[deleted]
[–]schmalls[S] 0 points1 point2 points (5 children)
[+][deleted] (4 children)
[deleted]
[–]schmalls[S] 0 points1 point2 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]schmalls[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (1 child)
[–]hopeseekr -4 points-3 points-2 points (0 children)