5 ms·
The setup time issue is an advantage of PHP over many languages. But, I will let you in on a little secret, once you know how to do it 'setup' time is a drop i
by Retric 14y ago
The setup time issue is an advantage of PHP over many languages. But, I will let you in on a little secret, once you know how to do it 'setup' time is a drop in the bucket on all platforms. And in the rare case where it might otherwise be hard, people setup a shell environment they can use as the template on any project and it just works.
That said, there are popular languages worse than PHP for most web development tasks, Java for example.
- kintamanimatt 14y agoBash is another example! I've always wanted to create a web app using Bash on Balls [1] [1] https://github.com/jayferd/balls/ https://github.com/jayferd/balls/
- chez17 14y agoThat was one point in favor of PHP, and it was a small one. I'm competent enough to set up any environment if the project required it. However, some hosting companies won't even let you do that. A client might have purchased a small package that won't even let you ssh in to do anything. That's a real life scenario that you have to consider. PHP works there.
- lukeschlather 14y agoPHP will always have an edge. If you want to do something stupidly simple, no other language can match. <?php $hackernews=file_get_contents("http://news.ycombinator.com); $hackernews =str_replace('Hacker','Interwebz',$hackernews); echo $hackernews; ?> Now that's horrible code, it has a dozen bugs aside from the security issues, but I would go so far as to say when I need to do something stupid like that quickly, nothing matches the simplicity of PHP. It's downright elegant. Not to say you should write a webapp in it, but I think you're wrong; there's intrinsic overhead in using a Real Language. It has nothing to do with "knowing how to do it," doing things properly takes time, a half-assed but mostly functional solution can be whipped up in minutes.
- deleted 14y ago[deleted]
- bradleyland 14y ago> Now that's horrible code, it has a dozen bugs aside from the security issues, but I would go so far as to say when I need to do something stupid like that quickly, nothing matches the simplicity of PHP. It's downright elegant. So: * It's horrible code * It has bugs * It's not secure ... * It's downright elegant See the discord there? It's not elegant at all. It's easy, but easy != elegant. It's just easy.
- lukeschlather 14y agoIt depends on the problem domain. I've seen PHP pretty similar to what I just wrote that worked without complaint. In some circumstances, great, bug-free, secure code is over-engineered and inelegant.
- saraid216 14y agorequire 'net/http' puts Net::HTTP.get(URI.parse('http://news.ycombinator.com')).gsub('Hacker', 'Interwebz') I'm confused. Where's the edge? Or, even simpler, require 'open-uri' puts open('http://news.ycombinator.com').read.gsub('Hacker', 'Interwebz')
- lukeschlather 14y agoI knew I was going to get some code golf responses. Simple and short are two different things. I value PHP over Ruby here because it's much clearer to the layman what's going on. To explain the PHP, all I have to explain is functions, variables, and the echo statement. To explain the Ruby, I have to explain functions, variables, Objects (everything is an object), Libraries, I/O, and method invocations. Also, in classic code golf form, your code eliminates a couple things that will make it do exactly the same thing as the PHP - you're missing your #! line, and you're not actually writing a CGI script, which is a second library you need to include and explain to your hapless newbie. And honestly, it's not just a newbie thing. I've written Ruby similar to that (with good error handling, etc.) Ruby only makes sense if you're going to do the job properly and put in error handling, etc.