Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Does anyone in here write PHP?

  1. Mar 4, 2013 #1
    I'm seeing all the awesome languages - Java, C, C++, Python, etc., but I'm not seeing any of the web-languages. I've yet to see a recent thread on ASP.NET or PHP, or much of anything like that.


    So, does anyone here know PHP?
     
  2. jcsd
  3. Mar 4, 2013 #2
    I've done a bit of PHP, but lately I'm using Python (Django) and Java EE for web programming.
     
  4. Mar 4, 2013 #3
    So do you prefer Python and Java for web?
     
  5. Mar 5, 2013 #4
    I could probably answer basic questions about PHP but I avoid it when possible. In my opinion it produces code which is ungainly and slightly harder to maintain than code in other languages might be. I prefer Python for web dev, django is great, tornado is great. I like tornado because I find myself more often lately creating web services than websites proper.

    There's a lot of work out there doing PHP tho.
     
    Last edited: Mar 5, 2013
  6. Mar 5, 2013 #5
    I'm not sure that I'm experienced enough with PHP to say that I definitely prefer Python and Java, but when I was using PHP I found my code was fairly hard to maintain, and I like how frameworks like Django and Java EE enforce structure. Also, I use Python and Java for non web programming, so it's nice that the skills I develop are transferable.

    I've only been using Django for a month or so, but I really like it. Puts the rapid into rapid web development!
     
  7. Mar 5, 2013 #6

    Borg

    User Avatar
    Gold Member

    All of the projects that I work on that originally used it, have all been migrated away from PHP. I fortunately haven't had to work with it much but, from what I've seen, it does become a maintenance headache. But, even the best architecture can be turned into that if the developers code it that way.

    I work with Java EE also. I'll have to check out Django to see what it can do.
     
  8. Mar 5, 2013 #7

    Borek

    User Avatar

    Staff: Mentor

    In my limited experience PHP is great for small hacks, but bad for serious projects.
     
  9. Mar 5, 2013 #8
    I'm confused as to why you all tend to think PHP is not good for large projects.

    You know, this forum software, vBulletin, is written in PHP, right?
     
  10. Mar 5, 2013 #9

    Borg

    User Avatar
    Gold Member

    Here's a good article on the pros and cons of PHP. The spaghetti coding in the first section was the biggest issue that I saw - perfectly good, clean code could go off into wonderland with one hack, making the entire site a pain to refactor or debug.

    PF has the advantage that Greg wrote it originally and it has probably had few other hands in there to screw it up (at least not inexperienced ones).
     
    Last edited: Mar 5, 2013
  11. Mar 5, 2013 #10
    PHP 5.4 is really great. It is a great solution for small to mid level applications. However as said above it will rarely be used for enterprise level applications. That is not necessarily a slam though. PHP was built for quick and flexible development. Tools like .Net and J2EE, and C++ are enterprise level, but they are rarely used for small and medium applications. They require far more resources and setup. PHP is the BMW M series cruising around the city. .Net J2EE C++ are the rocket ships flying off into space. Just like you wouldn't want to fly a BMW into space, you wouldn't want to fly a rocket ship in downtown NYC.
     
    Last edited: Mar 5, 2013
  12. Mar 5, 2013 #11
    That is a really, really good analogy, actually. :)
     
  13. Mar 5, 2013 #12

    Borg

    User Avatar
    Gold Member

    :rofl: That would be my experience with it.
     
  14. Mar 5, 2013 #13
    haha yeah yeah, fixed the typo :D
     
  15. Mar 6, 2013 #14

    harborsparrow

    User Avatar
    Gold Member

    PHP would not be able to perform well enough for some enterprise applications, with high traffic. Possibly, Python might not either. Usually, large corporations use either Java or ASP.NET for high performance. I've done a lot of coding for the web in both Java and ASP.NET. I love both, but have used ASP.NET somewhat more. It is very powerful and I love it (using C#). Also, very stable, with a lot of power and automation available to help do things quickly. As languages, though, I like PHP and Python just fine; I'm just talking about the whole platform and performance related to each technology.
     
  16. Mar 6, 2013 #15

    harborsparrow

    User Avatar
    Gold Member

    I don't agree about setup on ASP.NET. Java is the one that is difficult to set up before use, because the various parts are made by different companies. ASP.NET, on the other hand, is completely under Microsoft's control and they make it extremely easy to get started and do things. Everything just works "out of the box" using their world-class dev environment (Visual Studio .NET) which has decent free versions available for download.
     
  17. Mar 19, 2013 #16
    PHP is an old language that's evolved without any real central control or direction, and it's plain inconsistent, containing many pitfalls and exceptions.

    There's nothing wrong with it, but it makes it harder on the programmer to write good code. It's true that gigantic sites like Facebook use php but they have a very large team of very smart developers. Likewise, vBulletin is very old and PHP was the correct choice in that era.

    If you're kind of coder that considers programming an art as well as engineering, PHP is doubly worse as it makes you feel bad everytime you run across one of its "wats". Perhaps the most famous "PHP is Broken" article is the claw hammer one, which sparked that gigantic meme campaign (the picture of the hammer with 2 claws) that went around literally every programming website and even got the developers to pitch in. http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/

    Don't let anyone tell you which language you should use, but many php programmers in the tech industry somewhat jokingly put "php apologist" as their job title :-)

    I gave up on PHP when I tried to compare two strings and found out that, if you have a string beginning with a digit, it converts them into a numeric type before doing the comparison, as a result, something like "34534534512300000000" == "34534534512312342434" comes out as true (it has to be longer than the size/precision of what I think it converts it to, which is a float?) which is plain nonsense and I just don't need a language that forces me to work out stuff like that. When I compare 2 strings, I obviously want to compare them as strings.
     
  18. Mar 19, 2013 #17
    That's completely untrue - Facebook and Wikipedia are PHP, Reddit and Youtube are Python. They're gigantic websites (I guarantee they see more traffic than the enterprise you work in, possibly unless you're Microsoft itself - but to be honest I think youtube gets far more traffic than microsoft.com does even when you throw in Windows Update) and they work, and fast.

    The reason you see ASP in old enterprises is they're already Microsoft shops and they're locked in.
     
  19. Mar 20, 2013 #18

    harborsparrow

    User Avatar
    Gold Member

    Plain old PHP is interpreted, and it does not "scale well" if there are hundreds of hits per second, as some major sites have. "Scale well" means it runs very slow under heavy load conditions. This has to do with how the interpreter and OS interact.

    Facebook uses PHP with an extra twist to deal with performance problems. They have written a system that compiles PHP to native code--I don't remember what it's called.

    PHP is absolutely fine for systems with light or medium loads.
     
  20. Mar 20, 2013 #19

    harborsparrow

    User Avatar
    Gold Member

    BTW, Facebook made their compiler for PHP open source, and I'm fairly certain Reddit etc use it as well. But it would be overkill for a private person doing a less-heavily loaded website to add that layer of complexity.

    Also, to use native compiled code on a website, you need a dedicated server, because there is a higher chance of crashing a server. Thus, many heavy-load enterprise quality sites use either Java or .NET (which runs safely in a virtual machine) so that one poorly coded web page cannot crash the server. Facebook and Reddit have redundant servers to deal with this eventuality, but this is more than a small enterprise can afford to do.

    I'm not trying to attack PHP; it's a great language to get started doing web coding. But it is not appropriate (all by itself) for every website.
     
  21. Mar 20, 2013 #20

    harborsparrow

    User Avatar
    Gold Member

    d3mm, I don't think your knowledge is completely up to date.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Does anyone in here write PHP?
Loading...