Does anyone in here write PHP?

  • PHP
  • Thread starter Chemicist
  • Start date
  • Tags
    Php
In summary, PHP is great for small to mid level applications, but it is rarely used for enterprise level applications.
  • #1
Chemicist
53
0
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?
 
Technology news on Phys.org
  • #2
I've done a bit of PHP, but lately I'm using Python (Django) and Java EE for web programming.
 
  • #3
So do you prefer Python and Java for web?
 
  • #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:
  • #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!
 
  • #6
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.
 
  • #7
In my limited experience PHP is great for small hacks, but bad for serious projects.
 
  • #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?
 
  • #9
Chemicist said:
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?
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:
  • #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:
  • #11
Greg Bernhardt said:
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 cursing 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.

That is a really, really good analogy, actually. :)
 
  • #12
Greg Bernhardt said:
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 cursing 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.
:rofl: That would be my experience with it.
 
  • #13
Borg said:
:rofl: That would be my experience with it.

haha yeah yeah, fixed the typo :D
 
  • #14
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.
 
  • #15
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.
 
  • #16
Chemicist said:
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?

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.
 
  • #17
harborsparrow said:
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.

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.
 
  • #18
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.
 
  • #19
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.
 
  • #20
d3mm, I don't think your knowledge is completely up to date.
 
  • #21
Facebook's implementation is called hiphop, it's compiled php, which is still php, since you write the same code.

Reddit uses pylons or pyramid with Python.

Here's a partial list of gigantic websites that use php: Facebook, Wikipedia, Flickr, Yahoo, SourceForge, Photobucket ...

I will tell you why people say PHP does not scale: It's not the performance. It's the fact that the language is a mess, and your developers will go nuts stepping on each others feet. That's why people say it doesn't scale. However given a pile of money to hire smart people, it's clearly possible.

Enterprises use .net because they're microsoft shops already and they can't get rid of IE6 (ask them about it) - or PM me, I people used to pay me to tell them how to get rid of IE6.
 
  • #22
Facebook is coded in PHP, BUT it is also run through a compiler to make it perform well, thus it is not "simply PHP". This distinction is important.

Simple PHP would absolutely not perform well enough for Facebook because it is interpreted.

Also, d3mm, your dismissal of "Microsoft shops" is incorrect. ASP.NET is highly popular as a web platform, and all the people using it are not, despite your claims, stupid.
 
  • #23
I'm stunned, you're saying I said things I never did.

1) When I did I ever call you or anyone else stupid? When did I ever dismiss microsoft shops?

2) Do you do understand the technical reasons why IE6 is still heavily used on enterprise INTRAnets and why it would cost an absolute fortune to get rid of it?

3) PHP is a server side scripting languge. You're confusing the interpreter or engine with the language. A standard PHP install actually uses the Zend engine. So your cmment about interpreter speed relates to Zend and not PHP. Even if you somehow use a cunning semantic argument to troll out of that, the fact still remains that only Facebook seem to have this issue, and they're the only people I can think of with 1 billion users on PHP. Most other people seem to be OK with it. You'd need to truly be a mega-site to have a problem with it. Really the issue with PHP is the language specification makes it hard to manage a large codebase.
 

1. What is PHP?

PHP is a server-side scripting language used for web development. It is primarily used for creating dynamic web pages and is often embedded into HTML code.

2. How is PHP different from other programming languages?

PHP is specifically designed for web development and is often used in conjunction with HTML. It is a server-side language, meaning it runs on a web server, and can generate HTML code to be sent to the client's web browser.

3. Do I need to know HTML to write PHP?

While HTML knowledge can be helpful when writing PHP, it is not necessary. PHP can be used to generate HTML code, so as long as you understand the basics of HTML, you can write PHP without extensive knowledge of HTML.

4. Is PHP difficult to learn?

The difficulty of learning PHP depends on the individual's previous programming experience and their dedication to learning. For those with experience in other programming languages, PHP may be easier to learn. However, with dedication and practice, anyone can learn PHP.

5. Can PHP be used for more than just web development?

While PHP is primarily used for web development, it can also be used for command-line scripting and creating desktop applications. It is a versatile language and can be used for a variety of purposes.

Similar threads

  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
11
Views
1K
  • Programming and Computer Science
4
Replies
107
Views
5K
  • Programming and Computer Science
Replies
16
Views
2K
  • Programming and Computer Science
Replies
18
Views
4K
  • Programming and Computer Science
Replies
8
Views
817
  • Programming and Computer Science
Replies
6
Views
2K
Replies
6
Views
1K
Back
Top