News for hackers. Stuff that matters.
Re:Learn PHP – Free interactive PHP tutorial by awestroke on Tuesday November 26, 2013 @09:43AM (#6801515)
Not trying to bash on PHP or perpetuate the knee-jerk PHP hate, but should we really encourage people to learn PHP?

Imagine the effects if the mainstream web development focus would shift from PHP to some more thought-through language(+framework?). The PHP-development community produces some really great things, imagine all that effort expressed through better and more efficient tools!

Re:Learn PHP – Free interactive PHP tutorial by Killswitch on Tuesday November 26, 2013 @10:00AM (#6801643)
> Not trying to bash on PHP or perpetuate the knee-jerk PHP hate, but should we really encourage people to learn PHP?

Too late, you already did. And yes we should. PHP is just as good as Ruby or Python.

Re:Learn PHP – Free interactive PHP tutorial by dscrd on Tuesday November 26, 2013 @12:11PM (#6802595)
> PHP is just as good as Ruby or Python.

I don't know if you're deliberately making a disgusting lie, a blatant troll or just lack knowledge. Either way, I wish to state, as someone who has several years of actual professional experience of all three, in very strong terms that this comment is nowhere near the truth.

But about the parent's question: I believe that no learning is ever wasted, so go ahead and learn PHP, but it might be a good idea to realize that it's quite unique in how badly designed it is, and that the rest of the programming world does many things differently.

Re:Learn PHP – Free interactive PHP tutorial by Segmentation on Tuesday November 26, 2013 @01:35PM (#6803185)
> in very strong terms that this comment is nowhere near the truth.

It was his opinion, not a fact. Just like this is your opinion and NOT fact.

Re:Learn PHP – Free interactive PHP tutorial by dscrd on Tuesday November 26, 2013 @07:01PM (#6805218)
> Just like this is your opinion and NOT fact.

Well, if that is your opinion, I do apologize.

Re:Learn PHP – Free interactive PHP tutorial by riquito on Tuesday November 26, 2013 @10:46AM (#6801955)
Maybe, but the standard library always makes my heart beat faster. We're talking about the language where you have pearls like strcspn, strtr, strstr, strpbrk and at least three different naming styles for the same group of functions (e.g. for strings strtr, str_replace, trim).

And good luck with handling non ascii data with the standard library.

PHP would need a highly deprecating major version to clean all the rubbish, but it will never happen (see the history of PHP 6.0)

disclaimer: I'm a PHP developer (during the day, but at night...)

Re:Learn PHP – Free interactive PHP tutorial by astrodust on Tuesday November 26, 2013 @11:43AM (#6802394)
No, it's not "just as good". It's stuck as web development language due to design constraints.

Python is useful for a lot more than web scripting, and so is Ruby.

Re:Learn PHP – Free interactive PHP tutorial by RyanZAG on Tuesday November 26, 2013 @12:11PM (#6802596)
I don't use PHP much - but if you're making a website, why is being able to do things other than make websites important? I wouldn't use Ruby or Python to make desktop or mobile apps anyway.
Re:Learn PHP – Free interactive PHP tutorial by astrodust on Tuesday November 26, 2013 @03:17PM (#6803885)
"Web sites" are just the tip of the iceberg today, there's a lot more to the internet than just that.

For example, if you wanted to add real-time connectivity to your app using something like Socket.IO (http://socket.io/) you're basically out of luck in the PHP world (http://stackoverflow.com/questions/6398887/using-php-with-so...), you'll have to do it in a different language.

I think people who invest a lot of time in learning PHP are getting less bang for their buck than they would learning Ruby or Python where their knowledge can be applied to broader disciplines.

Do you need to process audio files? Maybe write a quick script to scaffold some Objective-C or Java code for your mobile app? What about writing a persistent process that watches for files on your network, processes them and uploads them to Dropbox?

All these things are really easy with Ruby, Python, or even NodeJS, you just glue together a few off the shelf modules and you're basically done. PHP is way out of its element in these sorts of situations.

Re:Learn PHP – Free interactive PHP tutorial by xd on Tuesday November 26, 2013 @04:19PM (#6804279)
There is nothing to stop you writing persistent PHP socket servers and there are many examples out there.

A quick and easy to digest example of an implementation of memcached in PHP: https://github.com/AndrewRose/cached.php

Re:Learn PHP – Free interactive PHP tutorial by astrodust on Tuesday November 26, 2013 @05:01PM (#6804561)
Yeah, like I'm going to use that in a production environment.

The libevent bindings are pretty wobbly in most languages other than C, with the exception of things like NodeJS. Plus, that project is pretty much abandoned.

Re:Learn PHP – Free interactive PHP tutorial by xd on Wednesday November 27, 2013 @03:49AM (#6807158)
It's an example of what can be done. And yes libevent has been abandoned but has also been superseded by http://us3.php.net/event

Your attitude is very insulting, did you know that? You have an obvious lack of understanding of the PHP ecosystem yet feel you can belittle it with off the cuff comments at will. Please stop this behavior as it drags the entire developer community down.

Re:Learn PHP – Free interactive PHP tutorial by astrodust on Wednesday November 27, 2013 @12:46PM (#6809738)
I've been spending a lot of time in the "PHP ecosystem" and honestly it's a disaster. It's comparable to a country like Brazil.

In some areas people are very well off, they have developer tools, they have best practices, they produce useful, workable code. Yet they're the elite minority.

Most people have nothing, get by with scraps of code scavenged from message boards or obsolete technical books, and bang together applications that are the code equivalent of a barrio. The level of ignorance about even the most rudimentary things like SQL escaping or string concatenation vs. interpolation is staggering.

Let me be honest, I don't care if I'm insulting. I'm not saying these things to make friends or win karma. I'm saying them because PHP has problems and I don't see a lot of effort being made to reach out to the average developer learning PHP who's stumbling along, all wrong if only because they don't know better and nobody's telling them otherwise.

I'm not going to suggest that other communities don't have problems, Ruby has a standard library that's embarrassingly bad, Python has a version schism they're at a loss to resolve, NodeJS is being held back by the crippling limitations of the V8 engine, but PHP is all that and more.

For example, if you're working on a complicated C++ application and need a simple script to emit some templated files you could roll this in Python, Ruby or even Perl and a seasoned developer would be okay with that. If you wrote it in PHP, though, they'd have reservations. Why, of all the scripting languages out there, would you pick that one? Why is PHP such an albatross?

I spent a lot of time in the Perl community back when it was still a thing and witnessed what happened to a language when people didn't complain or, as you say, insult it enough. Unconditional love isn't a bad thing when dealing with people, I'm all for things being civilized, but it's toxic when applied to programming languages.

You love your pet language too much and you'll smother it, every time. Smalltalk suffered greatly because of this attitude, people pretty much loved it to death.

You want your favorite language to evolve? Be its worst enemy. Find things about it you hate so much you can't stand to endure them any more and fix them. Bitch about things that aren't right, take a stand, and be the squeaky wheel.

Every time I get into one of these discussions about PHP with someone who seems to be a big supporter of the language, I ask for one thing: Don't just tell me PHP is great, show me. Is there a guide to PHP better than PHP the Right Way (http://phptherightway.com/) that encourages people to do things correctly so they can have an experience like yours?

Re:Learn PHP – Free interactive PHP tutorial by xd on Wednesday November 27, 2013 @01:23PM (#6810006)
Nice rant. But it doesn't change the very simple fact that you have been spreading ignorance in regard to PHPs capabilities. You also show nothing but a very subjective view of PHP based on, what I can only guess at, is your own gut feelings.
Re:Learn PHP – Free interactive PHP tutorial by astrodust on Wednesday November 27, 2013 @04:51PM (#6811399)
On the contrary, I've been doing what is as much as "Doctors Without Borders", trying to get new developers on Stack Overflow using PHP to stop doing things that are damaging. There is a non-stop influx of those that have almost no idea what they're doing, and no idea where to turn for help, composing these desperate pleas to explain what's often something so elementary nobody bothers to discuss it.

I don't know how many hours I've spent answering simple questions and promoting incrementally better practices, but it's got to be in the hundreds by now. I'm not even a PHP developer, I'm only focusing on the intersection between PHP and MySQL where a lot of deadly dangerous mistakes can be made, and there's not much in the way of push-back when you're going horribly awry.

Perhaps this gives me the perspective of someone working in the emergency room, where everyone seems to be on the brink of death, which is not at all like the real world. I can only report on what I'm experiencing.

If there were better resources I could link to as a sort of intervention, to help mitigate how bad this can be, I'd like to know. Right now it's like a never-ending stream of new coders with some serious MySQL escaping issues that they don't know about and problems related to the completely awful training material they've been exposed to.

If you think I'm exaggerating, just look at the sorts of questions that show up constantly and demonstrate how real-world PHP developers are producing code. Examples are so rife you can barely find a question without serious problems: http://stackoverflow.com/questions/20252023/how-to-create-au... is all too typical. Why are people writing code this way?

This does not happen in the Python or Ruby worlds. You'll get ambushed by people who will coach you in how to use Django or Rails.

Re:Learn PHP – Free interactive PHP tutorial by xd on Tuesday November 26, 2013 @04:11PM (#6804235)
"It's stuck as web development language due to design constraints"

PHP comes with a CLI SAPI that allows you to use it on the command line just like python, ruby etc and has done so since version 4.2.0 (released April 2002). I've written and maintained many cli tools and deamons in PHP over the last 11 years with great success so please get your facts straight before perpetuating falsehoods .. sorry, but I'm getting pretty sick of the ill-informed PHP bashing going on round these parts.

Re:Learn PHP – Free interactive PHP tutorial by Killswitch on Tuesday November 26, 2013 @12:30PM (#6802730)
Weird, then all these big companies who use PHP are wrong? And the fact that PHP dominates the web is wrong? Hmmm... I think you're wrong.
Re:Learn PHP – Free interactive PHP tutorial by astrodust on Tuesday November 26, 2013 @03:13PM (#6803861)
Right or wrong is highly subjective. Big companies use Java. Does that mean you're doing it wrong if you're not using Java?

I think you're misunderstanding what I'm saying.

Re:Learn PHP – Free interactive PHP tutorial by farresito on Wednesday November 27, 2013 @03:26AM (#6807098)
It's free to criticize PHP; that's why everybody does it, but at the end of the day the quality of a certain product depends on the programmer, not the language.
Re:Learn PHP – Free interactive PHP tutorial by Conlectus on Tuesday November 26, 2013 @10:14AM (#6801734)
I would say from a usability / opportunity of employment standpoint they are equal, but PHP seems when working with it far less "designed" than Python and Ruby in my opinion. Things like the inconsistency of single word / snake case / camelcase in method names etc.
Re:Learn PHP – Free interactive PHP tutorial by parasight on Tuesday November 26, 2013 @09:49AM (#6801563)
What about people working with legacy code? When I started at my current employer there was a quite a chunk of code written in PHP so learning some PHP wasn't optional.
Re:Learn PHP – Free interactive PHP tutorial by ben0x539 on Tuesday November 26, 2013 @11:24AM (#6802247)
But then those people don't need the encouragement, do they?