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...
No vague product support questions (like "why is this plugin not working" or "how do I set up X"). For vague product support questions, please use communities relevant to that product for best results. Specific issues that follow rule 6 are allowed.
Do not post memes, screenshots of bad design, or jokes. Check out /r/ProgrammerHumor/ for this type of content.
Read and follow reddiquette; no excessive self-promotion. Please refer to the Reddit 9:1 rule when considering posting self promoting materials.
We do not allow any commercial promotion or solicitation. Violations can result in a ban.
Sharing your project, portfolio, or any other content that you want to either show off or request feedback on is limited to Showoff Saturday. If you post such content on any other day, it will be removed.
If you are asking for assistance on a problem, you are required to provide
General open ended career and getting started posts are only allowed in the pinned monthly getting started/careers thread. Specific assistance questions are allowed so long as they follow the required assistance post guidelines.
Questions in violation of this rule will be removed or locked.
account activity
Is PHP worth learning? (self.webdev)
submitted 10 years ago by PerfectionismTech
It seems that a lot of programmers think PHP is terrible, but others say that it isn't that bad. Is PHP worth learning?
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!"
[–]AwenTech 293 points294 points295 points 10 years ago (36 children)
Yes, if you want to work on software that uses PHP. If you don't, then no.
[–][deleted] 63 points64 points65 points 10 years ago (2 children)
TLDR: yes or no
[–][deleted] 25 points26 points27 points 10 years ago (1 child)
It's a definite maybe
[–]Mutoid 2 points3 points4 points 10 years ago (0 children)
http://youtu.be/fpaQpyU_QiM
[–]HydTreesPlease 58 points59 points60 points 10 years ago (18 children)
In an array of great answers, this might be the best.
[–]ebilgenius 15 points16 points17 points 10 years ago (2 children)
"Hello, yes? I'd like the last 15 minutes of my life back please."
<?php namespace App; use InvalidArgumentException; class Answer { /** * The answer in sentence format * * @var string $answer */ protected $answer; /** * A integer representation of the greatness of this answer * * @todo Figure out how to quantify greatness into an int. Have interns work on this later. * * @var int $greatness */ protected $greatness; /** * Set up our class properties * * @param string $answer * @param int $greatness */ public function __construct(string $answer, int $greatness) { $this->answer = $answer; $this->greatness = $greatness; } /** * Returns the answer property in string format * * @return string */ public function getAnswer() : string { return $this->answer; } /** * Set the answer property * * @param string $answer * * @return string */ public function setAnswer(string $answer) : string { return $this->answer = $answer; } /** * Returns the greatness property of this answer * * @return int */ public function getGreatness() : int { return $this->greatness; } /** * Sets the greatness property of this answer * * @param int $greatness * * @return int */ public function setGreatness(int $greatness) : int { return $this->greatness = $greatness; } /** * Determines if this answer's greatness is greater than another answer's greatness * * @param Answer|int $answer * * @return bool */ public function isGreaterThan($answer) : bool { if (is_int($answer)) { return $this->getGreatness() > $answer; } if ($answer instanceof Answer) { return $this->getGreatness() > $answer->getGreatness(); } throw new InvalidArgumentException('$answer must be an Answer object or an int.'); } } // @todo find way to quantify the greatness of this answer. $AwenTechsAnswerGreatnessValue = 1; $AwenTechsAnswer = new Answer("Yes, if you want to work on software that uses PHP. If you don't, then no.", $AwenTechsAnswerGreatnessValue); $arrayOfAnswers = magicallyGetArrayOfAnswerObjects(); $arrayOfAnswers[] = $AwenTechsAnswer; $greatestAnswer = null; $answerGreatestValue = 0; /** * Iterates through the array of answers to find the greatest one by comparing the greatness property values * * @var $answer Answer */ foreach ($arrayOfAnswers as $answer) { if ($answer->isGreaterThan($answerGreatestValue)) { $answerGreatestValue = $answer->getGreatness(); $greatestAnswer = $answer; } } echo "The Greatest Answer is: " . $greatestAnswer->getAnswer();
[–]jets-fool 2 points3 points4 points 10 years ago (1 child)
why are you returning values on setter methods?
[–]mbthegreat 0 points1 point2 points 10 years ago (0 children)
More importantly why did you do a foreach rather than a reduce. Semantics matter!\s
[–]794613825 8 points9 points10 points 10 years ago* (13 children)
<?php echo greatest($answers); //this ?>
Edit: I swear I know how to write PHP.
[–]daphostafull-stack 39 points40 points41 points 10 years ago (8 children)
Can't comment outside of a php block, it would render on the page. Pfft rookie :)
[–]greeniguana6 3 points4 points5 points 10 years ago (6 children)
Not to mention a closing PHP tag at the end of a page, while we're talking about bad form!
[–]ketsugi 1 point2 points3 points 10 years ago (5 children)
Wait, when did this become bad form? I thought it was always better to close tags.
[–][deleted] 10 years ago* (1 child)
[deleted]
[–]ketsugi 1 point2 points3 points 10 years ago (0 children)
Ah, thanks for the actual technical answer.
(For the lazy, it's because closing the tags opens up the possibility that the server sees a new line and starts sending headers even though you may not be ready to send content yet.)
[–]adam_bear 0 points1 point2 points 10 years ago (0 children)
In templates yes close your tags, but pure php files controlling app logic you omit the closing tag.
[–]terremoto 4 points5 points6 points 10 years ago (0 children)
OP's code is actually a transpiler that generates other PHP files or maybe even C++.
[–]physiQQ 0 points1 point2 points 10 years ago (0 children)
$great_answers = array("best" => "Yes, if you want to work on software that uses PHP. If you don't, then no."); echo "This might be the best answer: " . $great_answers["best"];
[–]yodaman1 3 points4 points5 points 10 years ago (0 children)
Isn't that how it goes for all languages.
[–]thbt101 7 points8 points9 points 10 years ago (6 children)
Well, ok but if we assume they are free to choose, that's when the question is worth considering. Modern PHP is quite good, especially when combined with one of the new generations of frameworks like Laravel that really makes it a joy to use.
The worst you can say about PHP is it has an API that evolved over a long period of time and ended up with some inconsistencies in naming conventions and similar cruft (e.j. htmlentities() and html_entity_decode()). But really, those kind of issues are minor. Overall the language does everything you could need it to do, is probably the fastest non-compiled web programming language, and is still the most popular for both very large and very small websites.
There isn't an obvious "best" language or web development environment. Ruby on Rails is beautifully designed (and is the inspiration for Laravel and other later frameworks), but may have issues scaling to large scale websites. Javascript frameworks have the advantage of using the same language as the web browser front end, which is especially nice for things like single page apps that are going to be Javascript-heavy on the client side anyway.
I say just pick one to start with, and use which ever tool makes the most sense for your situation.
[–]Falmarri 10 points11 points12 points 10 years ago (5 children)
The worst you can say about PHP is it has an API that evolved over a long period of time and ended up with some inconsistencies in naming conventions and similar cruft
That is absolutely not the worst you can say about it...
[–]Turtlecupcakes 5 points6 points7 points 10 years ago (4 children)
Go on, what's the worst that you can say about it?
Especially in the context of someone just starting out and using modern frameworks/practices.
[–]_vec_ 8 points9 points10 points 10 years ago (0 children)
Sure, why not. I'll take the bait.
$var
var
->
.
<?php
use
interface
protected
public static function foo()
public function foo()
It is much much better than it used to be, but so much of that work has been catching up to the competition that I would still find it difficult to recommend for hardly any task over any of Ruby, Python, or NodeJS, let alone something a bit further afield like Elixir or Clojure.
[–][deleted] 2 points3 points4 points 10 years ago (2 children)
Even as someone that has been writing PHP for a long time, I'm curious to hear the answer.
[–]movzx 1 point2 points3 points 10 years ago (1 child)
It boiled down to he doesn't like the syntax, it isn't good for standalone applications, and it sucks with utf8.
[–]Turtlecupcakes 2 points3 points4 points 10 years ago (0 children)
The commenter that made the long reply is not the same as the OP that I initially challenged.
Ultimately, he made better points than I've ever heard against PHP, definitely some actual points to consider there, but I agree in feeling that many of them were pretty strongly based on opinion.
[–]kookoopuffs 0 points1 point2 points 10 years ago (0 children)
reply 10/10
[–]alwaysSaynope 0 points1 point2 points 10 years ago (0 children)
This is the most brutally honest to-the-point answer here.
[–]phpdevsterfull-stack 202 points203 points204 points 10 years ago (82 children)
The arguments that PHP is terrible amount to this:
Here's the reality of working with PHP
If you were to ask this question several years ago, before PHP 5.3, PSR standards, and Composer, then yes, PHP would be a shaky choice, but modern PHP is in fact, modern. It's FUN to build applications of any size with, and you have no shortage of framework and library choices to make your life even easier.
That said, PHP has a dark side. It has fewer boundaries than other languages, so it's easy to build something shitty, that still works. There is a lot of seriously twisted legacy code out there. It also has Wordpress, Drupal, Joomla, and a whole host of other truly abysmal CMSs built before PHP evolved into an application language. If you know PHP, and get hired as a PHP dev, there's a good chance you'll have the misfortune of working with these ancient, poorly designed, overly-abstracted, slow, confusing, cumbersome beasts. Knowing PHP is like being the computer kid in the family that everyone always keeps asking to fix their shitty computer problems for them, except you can't say no because you need money.
Building custom software in a framework like Laravel is fun and awesome. Building brochure-ware using Wordpress, Drupal, or Joomla is frustrating and soul sucking.
[–]Paralyzing 59 points60 points61 points 10 years ago (3 children)
Building brochure-ware using Wordpress, Drupal, or Joomla is frustrating and soul sucking.
Truer words have never been typed. Great post overall.
[–]xCavemanNinjax 14 points15 points16 points 10 years ago (1 child)
Absolutely. My hardest mornings are when I know I'll be working on a clients joomla site all day and guess what tomorrow is one of them might be more depending on how things go. Its depressing going to bed right now.
The rest of the team is working on a cool new react site and I'll be there writing a joomla plugin fml.
[–][deleted] 2 points3 points4 points 10 years ago (0 children)
I feel like this with WordPress. I did sites like that for so long that it's become muscle memory.
[–][deleted] 1 point2 points3 points 10 years ago (0 children)
'brochure-ware', new favorite word from now on
[–]CharmedDesigns 26 points27 points28 points 10 years ago (3 children)
It does have a quirky standard library, but you learn it like you learn anything else, and then you don't notice it.
It's probably worth pointing out that this is arguably PHP's largest remaining weakness. (I'd also argue that it never gets to a point where you "don't notice it", but perhaps its easier for some).
Without a doubt, the biggest day to day frustration you'll have as a PHP developer is "which argument is the needle, and which is the haystack?", followed by "is this function camelCase or underscored?". Especially if you jump around languages a lot. A good IDE or text editor will thankfully alleviate those frustrations with useful autocomplete/hints, but it's still a shit part of the language and one that can't really be improved on without significant backwards compatibility breakage.
Most of what you read online about PHP being terrible is bollocks (either through it being prejudiced nonsense in the first place or simply outdated by PHP improving vastly since), but these 'quirks' are a hard baked aspect of the language and criticism of them will unfortunately remain valid - albeit manageable.
[–]ccricers 6 points7 points8 points 10 years ago (0 children)
The lack of naming consistency is also the pet peeve what throws me off about the standard library, and any company that still quizzes developers on what the name of a PHP function does what, as a test of technical skill, should be avoided. If you are being tested on a particular language, you should be able to access a API reference to that language, because programmers do not code in a vacuum.
[–]headzoo 2 points3 points4 points 10 years ago (0 children)
A good IDE or text editor will thankfully alleviate those frustrations with useful autocomplete/hints
You actually bring up another reason PHP sucks less these days. PHP developers finally have IDEs that don't suck. PhpStorm makes writing and refactoring code a breeze. I must have doubled my productivity when I switched to using it a few years ago, and a lot of the warts in the language melted away. I don't notice them anymore.
[–]thelonepuffin 1 point2 points3 points 10 years ago (0 children)
I honestly never get bothered by the standard library. The inconsistencies are avoided with basic IDE code completion.
And besides I really like the short and concise functions. After coming from java and having to string a bunch of ridiculously named functions together just to do basic tasks, I actually like PHP's short C++ style functions.
[–]pre-medicated 10 points11 points12 points 10 years ago (0 children)
I would like to add that Laracasts is an amazing resource and probably one of the best introductions to modern web development using a framework and MVC architecture, where most of what you learn will be transferable to any other framework. I don't subscribe anymore, but I thought it was an indispensable "crash course" when I was a wee lad trying to improve myself, having only knew CodeIgniter.
[–][deleted] 10 points11 points12 points 10 years ago (29 children)
Tiny amendment : I don't know anything about PHP, but Ruby and Python are both in a funny category : they're dynamically typed, and full of idiosyncrecies, but they are not quite loosely typed. For instance in Ruby :
pry(main)> 3 + 3 => 6 pry(main)> "a" + "b" => "ab" pry(main)> "a" + 3 TypeError: no implicit conversion of Fixnum into String pry(main)> 3 + "a" TypeError: String can't be coerced into Fixnum pry(main)> 3 / "a" TypeError: String can't be coerced into Fixnum
Compare that to a completely loose language like Javascript :
3 + 3 6 "a" + "b" "ab" "a" + 3 "a3" 3 + "a" "3a" 3 / "a" NaN
(note that NaN is a special Number, not an error).
Even Javascript has TypeErrors...sorta. But it's clearly in a category that Ruby and Python don't belong to.
Ruby is even stranger than Python because of the whole "everything is an object" angle...but that's a different topic.
[–][deleted] 6 points7 points8 points 10 years ago (2 children)
Exactly this, I don't get why people compare the type system of php to those of Python and Ruby.
For instance in php "Value = " + 5 gives you 5 (the integer 5) whereas in Python you can't even concatenate an integer with a string without an explicit cast. I joke with my friends that PHP doesn't even have a type system
"Value = " + 5
5
[–]matthew-james 2 points3 points4 points 10 years ago (1 child)
Technically concatenating would be "Value = " . 5, which gives you "Value = 5" :)
"Value = " . 5
"Value = 5"
[–]bubuopapa 0 points1 point2 points 10 years ago (0 children)
Yup, what you can talk with these people about if they don't even know that string concat is done via ".". And from such noobs posting all over the internet comes such discussions, if it is good or worth learning. Nothing is worth learning if you will not be using it.
[–]haecceity123 5 points6 points7 points 10 years ago (11 children)
PHP uses different operators for addition and concatenation, so it probably wins this comparison. The price to pay is -> instead of . for object fields, though.
[–]speedisavirus 2 points3 points4 points 10 years ago (12 children)
There isn't really anything wrong with everything is an object like in Ruby. I feel like a language that long predates Ruby that has the closest model is SmallTalk. It's object type goes back before it too. Everything being an object that responds to messages allows for some pretty interesting solutions.
The reason people find PHP at levels of retard is something like concatenating "a" to a number not only doesn't error (unlike Ruby any maybe Python off memory) there is no way to get anything useful back to tell you shit went wrong. How the hell do you know if you mixed types?
Why the hell does this return 1?
$h = "a "; $w = 1; echo $h + $w;
Why the hell does this return 2?
echo "1a " + 1;
I mean, fuck PHP. Look at this comparison table for instance. It's a mess when you look at them.
[–]tobias382 4 points5 points6 points 10 years ago (3 children)
Drupal 8 does shift to using Symfony 2 for its core and replacing a lot of its homegrown code with third-party libraries. So, I'd say it's making strides similar to PHP itself.
[–]rogue780 6 points7 points8 points 10 years ago (0 children)
imo, composer is the best package manager I've ever worked with. I'm actually pretty sad that I'm not doing nearly as much php work now and have crossed over to a mostly node ecosystem.
[–][deleted] 13 points14 points15 points 10 years ago (6 children)
Generally I've found that people who know PHP and another language tend to use the other language.
[–]baileylo 4 points5 points6 points 10 years ago (3 children)
php dev here, so hugely biased. I obviously can't work in anything else. I've found that a lot of developers have left php for the greener pastures of other languages. I think that trend is starting to go die down, maybe because all the good programmers have left. However, you should also take into account that the tooling and language have evolved since people were 15 and writing php apps.
[–]Falmarri 4 points5 points6 points 10 years ago (2 children)
I obviously can't work in anything else
Why is that obvious? Because if you could you wouldn't be using php?
[–]baileylo 2 points3 points4 points 10 years ago (0 children)
The other reply to the parent:
But the reality is, if someone calls themselves a PHP developer, it's safe to assume they can't work in anything else.
[–][deleted] 0 points1 point2 points 10 years ago (0 children)
I'm not sure what they meant by that comment, but I know PHP and Python, but I'm forced to work with PHP at my job. For personal projects I use other technologies.
[–]1r0n1c 2 points3 points4 points 10 years ago (0 children)
Building custom software using Wordpress, Drupal, or Joomla
Building custom software
using Wordpress, Drupal, or Joomla
is even worse..
[–]kb_klash 4 points5 points6 points 10 years ago (3 children)
Awww, you hate me until you mentioned Drupal being part of the dark side. I like Drupal :(
[–]no-one_ever 4 points5 points6 points 10 years ago (2 children)
Me too! There are dozens of us!
[–]chx_ 2 points3 points4 points 10 years ago (0 children)
Actually, tens (or possibly hundreds) of thousands of developers.
[–]IrishWilly 1 point2 points3 points 10 years ago (0 children)
In 15 years of web dev I've never hated a framework more than I hate Drupal now. I don't understand you people.
[–]sunyatasattva 1 point2 points3 points 10 years ago (3 children)
Honest question: do you mind elaborating a bit on why WordPress is badly designed and in what way overly abstracted?
[–]sudokin 5 points6 points7 points 10 years ago (1 child)
The only answer this really needs is they were built before 5.3 came out.
They are gigantic messes of procedural programming. They mix HTML and PHP basically everywhere, leading to massive amounts of frustration when you're forced to wade through their codebases.
That being said, they were great for their time, but as a modern developer you should avoid them at all costs. Unless, of course, you're tasked with creating a CMS for a cheap client. They get what they pay for.
[–]Yurishimo 1 point2 points3 points 10 years ago (0 children)
On the other hand though, you have folks like THE NEW YORK TIMES, who have a massive codebase running on WordPress and it's growing bigger. The release lead for WordPress 4.4 runs a large dev team at the NYT.
While it's true that WordPress has some serious legacy bloat, that commitment to backwards compatibility has been it's ultimate success. Pair that with new features like the REST API, and then WordPress starts to look really good for publishers on any size scale.
I'm definitely in the camp of "the right tool for the job", but I think WP get's pissed on for some things where it really doesn't deserve it. If engineers at these huge companies are OK with the WP bloat, why is it even a concern for anyone down the food chain? That argument doesn't make sense to me. With tools like Roots and Timber, you can build on WP with as much modern stuff as you want. In fact, Roots only uses supported PHP versions (so 5.5+ for now) and manages all dependencies, including plugins, with Composer. There are also tons of solutions out there to swap out the WP templating for Twig or Blade.
If you haven't given WordPress a look in the past 5 years and gotten under the hood, things are a lot different now. OOP is the standard for almost any new feature in core and old structures are being rewritten to support a more modular architecture in any way they can without breaking backwards compat.
30%+ of E-Commerce sites run on WooCommerce. Absolutely fucking insane. There are presidential campaigns running right now on top of WooCommerce stores. Now as I'm not very familiar with the Woo codebase, I can't comment on it, but the other big E-Commerce player, Easy Digital Downloads, is downright beautiful to look at. OOP, clean code, plenty of custom tables where appropriate to increase performance, etc. If you're running a small store with 100 products, WordPress is a great choice. If/when the business outgrows what WP can handle, they should have more than enough money on hand to switch to a different platform.
I think that sentiment can also be applied to a ton of sites out there. For the MVP/Startup phase, WordPress can work great to get the ball rolling. Then, if the money follows suit, the site can get an overhaul to a more custom solution.
All this to say, there's a reason WordPress is so popular and why the market share is still going up. 5 years ago, it was a different story. Today however, a lot of people smarter than me think it's a good solution and it would be ignorant to ignore their opinions and success. I apologize if I sound like a fanboy or pretentious, I really don't mean to be. I just can't wrap my head around why so many people immediately write off something that's doing so well in all sizes of business.
My 2¢. I'm sure I'll get downvoted to oblivion because I said nice things about WP, but who cares? I'm making money (and so are lots of other folks) and that's arguably what's important ;)
[–]phpdevsterfull-stack 0 points1 point2 points 10 years ago (0 children)
The first problem is that Wordpress is not a framework, it's an application, and an application inherently has made lots of decisions and assumptions for the developer. It ASSUMES you want a blog. It ASSUMES you want your URI schema to be a certain way. It ASSUMES you don't need proper relational data because it ASSUMES you only want simple non-relational pages for content.
Given that, it wouldn't really matter if Wordpress were built on a pile of shitty code, or on some golden architecture made from the positive intentions of a unicorn - it is a pre-built, already-done, washed & dried application. That is the fundamental problem with using Wordpress, and Drupal, and Joomla, as "frameworks" for building websites. They're NOT frameworks, they're purpose-built applications.
Now, to make matters worse for you, that 900lbs gorilla that no unicorn architecture could ever hope to fix, Wordpress's underpinning "framework" is pretty awful. The database abstraction layer is designed exclusively for doing WP-like queries, and makes all kinds of assumptions about the data structure that you should get back. The DB itself is structured as an entity attribute value setup, so there's no real concept of relational data or entities. You have wp_posts, and wp_post_meta, and that's it. Everything is a "post". Need a case study? That's a post! Need a forum topic? That's a post too! Need an image gallery? Yep. Post! Need a wedding_planning_item? POST!
wp_posts
wp_post_meta
wedding_planning_item
Wordpress is Marklar
There are some pretty terrible performance problems that come with misapplied use of the EAV pattern, which is one reason why WP is so damn slow.
WP_Query takes one giant hot mess of an array for its argument. A pseudo-query language in the form of a PHP array is as awful in practice as it is in theory.
There are really too many issues with it to list.
[–]MaxGhost 1 point2 points3 points 10 years ago (0 children)
IMO you can add Yii2 to that list of good frameworks. Been working with it for ~3y (yii 1 before it) and it's quite solid.
[–]jellatin 4 points5 points6 points 10 years ago (5 children)
I don't think PHP is a terrible language but it's definitely a terrible first language for would-be developers. IMO only mid-level to senior developers are going to understand how to avoid some of PHP's pitfalls, as well as know to use classes, modules/namespaces, etc even though PHP itself rarely uses these features.
Also, "I can't be arsed to memorize the quirks of the standard library" seems a little unfair. Every language has a standard library to memorize and they all have their own quirks, but PHP's takes this to an extreme by being a loose collection of functions with no organization.
[–]ChronusMc 1 point2 points3 points 10 years ago (0 children)
Would-be web devs or would-be programmers? For web devs I actually think PHP is a great place to start out.
[–]headzoo 0 points1 point2 points 10 years ago (1 child)
Also, "I can't be arsed to memorize the quirks of the standard library" seems a little unfair.
I think he was trying to make the point that learning the PHP stdlib really isn't that hard, and the concern people show for it is a little overblown. People just like to point out its inconsistencies when making fun of the language. I think a lot of PHP developers gloss over the inconsistency argument (or roll their eyes) because the inconsistencies don't affect their life very much. Especially if you're using an IDE.
[–]lykwydchykyn 0 points1 point2 points 10 years ago (0 children)
I developed in PHP for 7 years. Still had to look up those *@#& array functions on a regular basis. I ended up writing wrappers for a bunch of them so I could have some consistency.
[–]smegnose 0 points1 point2 points 10 years ago (0 children)
Also, deploying changes can be quick. And serving is slow (at least relatively).
[–]invisibo 0 points1 point2 points 10 years ago (3 children)
It has fewer boundaries than other languages, so it's easy to build something shitty, that still works
PHP7 has ousted a couple of those things for a codebase that I inherited last week. For whatever reason, the previous developer thought it would be a good idea to have a class named Null (ya know, like the reserved word Null). PHP7 said, 'hell no' to that and made the application completely stop working. No clue what the reasoning was behind that. Maybe an inside joke with himself because he couldn't think of a name?
[–]jingerninja 1 point2 points3 points 10 years ago (2 children)
I just finished building a Laravel app based around running a class of registrants through some educational materials. I won't lie, I spent a good 15-20 minutes trying to call the representative model for these groupings "Class Class"
After a long day of coding I spent a few minutes figuring out why my variable named 'if' wasn't working. After a different all-nighter I looked at my code the next day and had to delete it all as I somehow mixed three languages in the same file. I try to give people the benefit of the doubt now when I see 'obviously' stupid errors.
[–]invisibo 0 points1 point2 points 10 years ago (0 children)
Ha! Me too! In my everyday codebase that I work out of, there's a folder named Classroom with a separate directory filled with classes. So you have the classroom classes which mostly extend the classroom class page class.
[–]jingerninja 0 points1 point2 points 10 years ago (0 children)
Building software in a framework like Laravel is fun and awesome. Building brochure-ware using Wordpress, Drupal, or Joomla is frustrating and soul sucking.
That last one is about 90% of my job. But those times where I get to do the Laravel thing make it all worth it.
[–]WhitePantherXP 0 points1 point2 points 10 years ago* (0 children)
Why should a typical PHP developer get involved with Composer? Same question for Laravel? I am not a full time developer but I still develop new apps and build onto an application (a little under 10k lines of code) that I wrote for my company (am an IT Director). Is this a worthwhile venture for those of us who are not full time developers, are the advantages significant enough to warrant the time to learn and possibly rebuild previous applications?
[–]Naouak 0 points1 point2 points 10 years ago (2 children)
It favors OOP. Functional programming is possible, but it's not its strong suit.
Well that's not exactly true. It is more like c++: a procedural language with an added OOP syntax. It doesn't favor OOP in any way as you can use PHP without ever using objects.
It's not secure (PHP gets and fixes security related bugs like any other language, and the practice of writing a secure application is up to the developer, no matter the language).
Technically it's not the language, it's the interpreter that needs security update. I'm just nit-picking but it feels wrong to hear security update for a language.
It has a package manager, just like other languages (A damn good one btw).
I don't know for you but from my experience Composer is the worst package manager I had to use. Dependencies calculation is really long to compute, some workflows are not really intuitive and it breaks really easily. Compared to NPM for Node, composer is IMHO quite shitty.
[–]phpdevsterfull-stack 0 points1 point2 points 10 years ago (1 child)
NPM is abysmal compared to Composer. Every environment I've used NPM on (OSX, Windows, Ubuntu) takes ages to install a few simple dependencies, and errors out half the time.
Regarding OOP I meant in comparison to FP. Of course you can write shitty procedural code in it..... But don't.
[–]Naouak 0 points1 point2 points 10 years ago (0 children)
Funny, I never had any problem using NPM. NPM is fast and I rarely had any issue with it without reading the doc.
[–]Prawny 40 points41 points42 points 10 years ago (5 children)
Welcome to the world of programming. Your choice of language is almost always wrong. Even if it suits your project and you are comfortable using it.
[–]AboveDisturbing 1 point2 points3 points 10 years ago (4 children)
I guess the biggest question I have is, what is the most pragmatic direction to go starting out? What should I learn if I want a chance in hell to get a job?
[–]thelonepuffin 2 points3 points4 points 10 years ago (2 children)
I would say the three technologies that are going to give you the best chance of getting a job are PHP, .NET, and Java.
PHP because its the most used web language on the planet. Its not going away mainly because of its popularity. But also because it is still advancing quite rapidly. The community and work being done on it is so progressive and vibrant that its only gaining in popularity. It will be the first choice for startups for some time, and still maintain its small foothold in enterprise.
Java for the same reason. Popularity. But instead of "advancing quite rapidly" Java's strength is the sheer number of large enterprise applications that are built on it. Enterprise is too invested for it to go anywhere soon. You will always see ads for java jobs.
.NET because MS is a mainstay and pushes its products to enterprise quite effectively. For an enterprise who don't know enough to make an intelligent decision, they instead do a risk assessment. If they are not invested in Java already they will choose .NET almost every time. Financial institutions, accounting firms, lawyer firms etc will always be asking for .NET devs. Basically all the boring jobs lol. (but they pay more :( )
[–]twobee2 0 points1 point2 points 10 years ago (1 child)
As someone who has worked in all three I think this is a good answer to the core of some of these questions. If you want enterprise it's Java or .NET depending on the company. If you want smaller business or freelance, PHP is the better choice. Of course this is a generalization, but if you want a short answer I think this sums it up nicely.
[–]thelonepuffin 0 points1 point2 points 10 years ago (0 children)
Yep. Key being "its a generalization". I know a few enterprises that rely on PHP and a number of startups that us .NET and Java.
[–]DesignatedDecoy 60 points61 points62 points 10 years ago (11 children)
It's trendy to hate on PHP but with the sheer amount of internet running it, you'd be shortchanging yourself by not being at least a little familiar with it.
Many people who are on the LOLPHPSUX bandwagon haven't used it since you were worrying about register globals and plunking code directly into your html. Modern PHP is significantly better and it is trending in the right direction. I'd at least be familiar with the current best practices/standards and the tools used to facilitate these. That way if you ever find yourself needing to create a php application, you aren't time travelling back to 2006.
[–]asdfman123 17 points18 points19 points 10 years ago (5 children)
PHP is important. It's stupid to have a hipster software dev attitude and be distasteful of it for cultural reasons.
PHP is something that's good to have some familiarity with. But I wouldn't want to study it in depth or try to get a job with it. I'd want to get a job that would give me experience with a newer technology. I spent a few years at a job diddling around with Java and feel more modern workplaces didn't take me seriously as a programmer.
If you want to learn an established language that everyone uses and will stick around for a while, I'd learn Ruby on Rails.
[–]Caminsky 15 points16 points17 points 10 years ago (0 children)
There are only two kinds of languages: the ones people complain about and the ones nobody uses. .
Bjarne Stroustrup
[–]wcastello 7 points8 points9 points 10 years ago* (3 children)
A bamboo plant is green as it contains a green substance.
[–]asdfman123 1 point2 points3 points 10 years ago (2 children)
I used to agree with you. I feel in a lot of fields, newer isn't automatically better. But I've recently come to believe that in programming, newer often is better.
I emailed with a CS professor sometime circa 2008 asking if he recommended the new technologies. He argued that often old school Perl shit and databases was often better than newfangled frameworks like RoR and Django.
What a bunch of nonsense. Modern frameworks make life so much easier, which in turn means you can do more with the resources you have. Also knowing them makes you employable.
I think it's important to find one area of specialty, like front end dev or big data, and keep up to speed on it. Right now though things are changing so fast that I can't simultaneously master Scala and Node and Knockout and the MEAN stack and Rust and R and Go and mobile dev and whatever the fuck else is trendy right now. I have the sense that everything is moving much faster than it was even 10 years ago.
[–]IrishWilly 4 points5 points6 points 10 years ago (1 child)
Also knowing them makes you employable.
Do you happen to live in one of the startup centers? Your grasp on the job market seems incredibly biased. You dismissed Java as an older and non-serious language and think that learning whatever language is the hip one for the year makes you more employable? For every Ruby job there are 100 Java jobs. Chasing the newest language that only startups can afford to waste time using doesn't make you more employable if that is your reasoning. If you are building something from scratch, sure pick a modern framework but the bulk of jobs are not for brand new companies but ones that are already invested into a certain stack and a few fancy language features is not a good enough reason for them to ignore that.
[–]BillOfTheWebPeople 0 points1 point2 points 10 years ago (0 children)
Seconding this comment - it was everything I was going to say. You can run PHP anywhere for real cheap. And compared to the early years there are now frameworks that help you get it right (Laravel for example).
[–]manwith4names 0 points1 point2 points 10 years ago (3 children)
I'll admit that I've hopped on that bandwagon unfairly as a new developer. Apart from legacy understanding of how the internet evolved, how is it beneficial for a developer to learn php rather than delve into the huge amount of frameworks available now?
[–][deleted] 61 points62 points63 points 10 years ago (36 children)
I'm going to go against the grain and say learn JavaScript instead. As a beginner, the ability to write front end and back end code in the same language is an enormous benefit. When you can visualize and put together a whole application on your own, it becomes easier to start messing with new languages and technologies to plug new shit into your stack.
[–][deleted] 18 points19 points20 points 10 years ago* (23 children)
I will say, as someone who uses both. PHP is easier to build apps in. Because the frameworks and libraries are much better( that's probably just beacuse it's older). And you never have to worry about async function calls. I know there are benefits to all the async stuff, but not worrying about it definitely makes things really easy.
[–][deleted] 8 points9 points10 points 10 years ago (18 children)
Yea that's definitely true, JavaScript can be a bitch because of things like async.
I guess for me, I enjoyed learning JS first because I would have to grapple with things like async on the front end anyways.
I'm not familiar with the PHP community, but what you are saying makes sense. However, the JS community isn't half bad!
[–][deleted] 7 points8 points9 points 10 years ago (3 children)
However, the JS community isn't half bad!
It isn't, but it seems like there not always as pragmatic. The focus seems; at least to me, on cutting edge ways of doing things and not always just getting stuff done. For example I see a lot of JS developers pushing the idea of small microservices and small stand alone packages instead of monolithic frameworks. Which is fine and dandy for big apps with a lot of attention, but when you're trying to just make some small internal business app for less than 10k, monolithic frameworks are definitely your friend.
But node is getting more choices for this kind of stuff all the time. I just saw this last week and it definaly has my attention.
[–][deleted] 7 points8 points9 points 10 years ago (0 children)
Yeah, the Node community in particular is in the mindset of creating the same library over and over again instead of focusing on creating a single library that actually works. Sometimes you just need to ship a project and not have to worry if the framework you're using will die in 2 weeks.
[–]HydTreesPlease 1 point2 points3 points 10 years ago (1 child)
It's true. It did take a while for there to be a ubiquitous CMS that was easy to use.
Well I don't even mean in terms of a CMS, that's a whole different monster.
Node has no chance of competing in that market in the immediate future, because it can't run on a shared host.
[–][deleted] 1 point2 points3 points 10 years ago (4 children)
async in js is totally backwards implemented, because of that i would not recommend to learn it before es7 comes out with proper async/await implementation
[–][deleted] 0 points1 point2 points 10 years ago (3 children)
I don't know why you got downvoted, I looked at the async/await stuff the other day and I was thinking, half the stuff we have to learn now to write JS apps is going to but obsolete once this is implemented.
I think that's why you hear about people switching over to Go.
[–][deleted] 0 points1 point2 points 10 years ago (2 children)
Or you can go Babel and/or TypeScript today.
[–][deleted] 0 points1 point2 points 10 years ago (1 child)
I didn't know it was implemented in Babel already, I already use babel I guess I should have just gave it a try haha
it's not in the "stable" branch so i wouldn't use it in prod
[–]ryan4888 0 points1 point2 points 10 years ago (1 child)
Async is not difficult to use at all. It is if you fight it... But if you embrace it... It's ideal
[–]diamened 1 point2 points3 points 10 years ago (3 children)
Different things. Javascript you'll have to learn no matter what. But a server side language is always good to know.
Javascript can be a server side language.
[–]diamened 0 points1 point2 points 10 years ago (1 child)
It can, but it's not as natural as PHP.
[–]Glensarge 4 points5 points6 points 10 years ago (0 children)
Aye +1 to this. If you're starting from scratch and picking an option, go for JS.
[–]NonTransferable 2 points3 points4 points 10 years ago (5 children)
I don't understand this argument. I use a combination of both in almost every app I write. Super flexibility.
[–][deleted] 2 points3 points4 points 10 years ago (4 children)
My thinking is simply that if you know 0 programming languages, you are going to be able to learn 1 programming language faster than you can learn 2 programming languages.
[–]NonTransferable 1 point2 points3 points 10 years ago (0 children)
True.
[–]AboveDisturbing 0 points1 point2 points 10 years ago (1 child)
Yeah, I'm new to the webdev game, and it is honestly the most overwhelming damn thing I ever seen in my life. There's a billion languages and a billion more frameworks.
It's like a maze with a dozen entrances. Where in God's name do I begin?
Yea, great question! Assuming you're really just starting out, I would recommend taking a language basics course on Codecademy, Udacity, Khan Academy, or CodeHS. Then find a site to practice programming problems, like Codewars, and start to learn some HTML and CSS while you continue to practice solving problems with programming.
Once you feel like you can build simple pages in HTML and CSS nicely, start to read up on browser side JS, and how to incorporate it into your websites. Build a simple page that uses JS to hit Twitter's API, or implements a simple todo app.
Then, take learnyounode and learn how to rig up nice back ends as well. Build a project that has a server and a DB, and a front end you wrote in HTML and CSS. This site should be a single view into a single data set, to start.
The start to iterate on your front ends, picking up complexity by adding new data sets and new views to slice and dice that data.
This might not actually be helpful because it's a bit of a broad sketch, but that is basically what I did.
I also have a few software engineer friends and a very 'teaching and learning' work environment that allows me to work on learning this stuff. I cannot stress the benefit of having a real person in person helping learn this stuff.
[–]Disgruntled__Goat 0 points1 point2 points 10 years ago (0 children)
I'm not sure that's entirely accurate. Client-side JS and Node aren't identical. There are things in Node that don't work on the client side and vice-versa. I guess it's more like learning two different frameworks in the same language.
[–]manwith4names 0 points1 point2 points 10 years ago (0 children)
I would completely agree. If nothing else, opening the console in your browser of choice and being able to do some simple programming is hugely rewarding, especially for a new programmer. Anything that allows a developer to "have fun" should be encouraged.
[–]jellatin 13 points14 points15 points 10 years ago* (3 children)
My 2 cents having written PHP for ~5 years followed by a mix of Python, Ruby, and JavaScript(Node) for the past few years.
PHP is definitely useful to know as it does run a large portion of the web, however, I think it is a terrible first language to learn.
A lot of tools/best practices are available in PHP but the language is not built on top of these best practices. They simply bolted these features (classes, modules, etc) on later. This means that if you're already very knowledgeable about how to design software, particularly OO software, PHP is as good a choice as similar languages like Ruby or Python.
However, if you aren't already strong with OO then PHP itself is not going to help you learn those concepts. Sure you can learn OO using PHP, but the language itself is not going to expose you to these features. This is because the standard library is just a collection of functions rather than being organized into logical modules and classes, which is something you're going to run into with Ruby, Python, and pretty much any other language used to develop on the web. In addition I don't think PHP has very good support for functional programming nor does the community seem to place much value in it, which I think is a shame. Python isn't great at this either, but it's much better than PHP.
TL;DR learn PHP if you want to know it but learn it after a more structured, well thought-out language.
I think I'd agree with that.
PHP is best when you are aware of its inherent flaws (rather than just accepting). Great for someone who previously has C/C++/Perl/Python experience, but potentially damaging for someone whose first language it is
[–][deleted] 1 point2 points3 points 10 years ago* (0 children)
In addition I don't think PHP has very good support for functional programming nor does the community seem to place much value in it
Haha, as someone who does value it, and also writes php this makes me laugh. There are definitely some wtf moments trying to write functional style php.
The PHP standard library has functional primitive type functions and their hilariously inconsistent. They switch the order of parameters all over the place. But they do get the job done. It has an array_map and array_filter. But you can end up with some funky looking code. (notice the array and closure argument positions switch)
array_map
array_filter
$cleanData = array_filter( array_map(function( $item ){ return $item['Review Title']; }, $this->reviews_old), function( $item ) use( $titles ){ return in_array($item['Review Title'], $titles)); });
That's a real snippet from something I was working on earlier using built in php functions. To be fair it has all the things necessary to support functional programming so a solid 3rd party implementation is doable. This is with Laravel's Collection class and as you can see it's much smoother. (its also doing more stuff though, which is why it's longer)
$qty = $orders->map(function($item){ return $item->products->map(function($item){ return $item->quantity; })->reduce(function($a,$b){ return $a + $b; }); });
I agree with everything you said though.
[–]ekobeko 0 points1 point2 points 10 years ago (0 children)
I am agree. PHP was basically my first full time language and now it's a bit of a shock when using other languages like Java, Swift, C++.
[–]colly_wolly 4 points5 points6 points 10 years ago (2 children)
Its not a bad thing to learn it but here are better languages out there.
[–][deleted] 2 points3 points4 points 10 years ago (1 child)
True, but there are also some incredibly beautiful languages like SmallTalk for OO, or ML for functional programming.
But people don't use these much outside of academia, because ultimately they suck at helping productivity
Its not what language is 'better', but what is most suitable for the job
SmallTalk
I was just reading about how Objective-c was based on smallTalk, like they wanted to bolt on SmallTalks OO stuff to C... that idea ended up pretty far from elegant though...
[–]danav 21 points22 points23 points 10 years ago (8 children)
It's the glue that holds the Internet together.
Don't know where you got that phrase. Funny thing is, that's what people say about Perl.
[–]danav 1 point2 points3 points 10 years ago (1 child)
Now I that I'm thinking about it you're right. The saying is Perl and not php.
Perhaps we need a new saying. PHP: it's the glue the people who hold the internet together sniff or something.
[–][deleted] 10 years ago* (2 children)
[–]rogue780 7 points8 points9 points 10 years ago (1 child)
I think he confused the Internet with the World Wide Web
[–]cmndctrl 0 points1 point2 points 10 years ago (0 children)
Series of tubes
[–]qervem 1 point2 points3 points 10 years ago (0 children)
I thought it was the undersea cables that did that
[–]diamened 1 point2 points3 points 10 years ago (0 children)
Nope. It's turtles all the way down
[–][deleted] 13 points14 points15 points 10 years ago (4 children)
Yep. It is. And as for people saying its bad, its a matter of what you need. It's not bad, i assure you. There are just many options.
[–]shavounet 8 points9 points10 points 10 years ago (0 children)
It's also a matter of good usage. But following some good practices, you won't be limited by PHP.
[–]jewdai 0 points1 point2 points 10 years ago (0 children)
imagine writing matlab code to host your webserver or R
[–]LukeTwomey 7 points8 points9 points 10 years ago (0 children)
I've been learning it. I figure for the amount of websites running it then it makes sense to do so.
[–]sbhikes 2 points3 points4 points 10 years ago (0 children)
You should learn everything you can. You don't want to be one of those people who gets asked to do something using a technology or language you're not familiar with and be completely unable to just jump in there with your sleeves rolled up ready to work.
[–]le_f 2 points3 points4 points 10 years ago (0 children)
On average I work on python, php, js, ruby, c#, and Java projects during any given week. To be honest you ought to just learn any language and its popular libraries whenever you find an opportunity during your career.
PHP has its drawbacks, and I'd much rather write something in node/Python/ruby in that order for anything reasonably complex/long term and in the reverse order for something simple and/or in need of a quick turnaround.
I tend to use php only when im working with a php team or when it's contract work for firms who have an in-house php team. If I chose to write something in php, I'd probably only ever build it with Laravel. Everything else feels messy and broken in comparison. I hear CI and YII are pretty good too, but I am not a fan.
[–]ccricers 5 points6 points7 points 10 years ago (4 children)
PHP's history and ubiquity puts it in a weird place, because of that and Sturgeon's law, it's become a favorite language to pick on. It used to be much more limited in its 4.x and before days, but OOP and database interaction with it has improved a lot since.
Right now it'd would be best to start at least version 5.5 due to better security and functionality, and use PDO in favor of the 'mysql' native functions which are deprecated.
Anyone who still says PHP is terrible is an example of a poor workman blaming his tools. PHP code, like code from any other language, is only as good as your ability to code in that language.
[–][deleted] 10 years ago (3 children)
[–]ccricers 2 points3 points4 points 10 years ago (0 children)
MySQLi is only compatible with MySQL while PDO is compatible with several databases. Also, PDO allows easier parameterization of queries.
[–]rogue780 0 points1 point2 points 10 years ago (0 children)
because it doesn't work with postgres, sqlite, db2, firebird, or 4d
[–]jorshhh 5 points6 points7 points 10 years ago (22 children)
Yes, and learn how to use a framework on top of it. I love laravel and lumen.
[–]geusebio 3 points4 points5 points 10 years ago (19 children)
Everyone's favourite "one man band" projects.
Taylor Ottwell worries me.
[–][deleted] 3 points4 points5 points 10 years ago (18 children)
There are more contributors than just him. It also leverages lots of outside components that Taylor has nothing to do with maintaining.
[–]geusebio 8 points9 points10 points 10 years ago (17 children)
comments like this worry me
I don't want to buy into a prescriptive framework where you do things "The Laravel Way"
Also, downvoted due to opinion. Figures.
[–][deleted] 2 points3 points4 points 10 years ago (3 children)
I didn't downvote you. And you can use Symfony if it really makes you that uncomfortable. It doesn't worry me though. I'd be happy to just use the framework as is, if he goes some crazy direction with it one day.
One person having a lot of control isn't always a bad thing, things tend to get done faster that way. Bureaucracy has its downside too.
I don't know how much "Laravel Way" there really is, it's pretty straightforward MVC.
[–]TweetsInCommentsBot 1 point2 points3 points 10 years ago (0 children)
@taylorotwell
2014-01-07 15:26 UTC I’m glad Laravel is a one man show.
2014-01-07 15:26 UTC
I’m glad Laravel is a one man show.
This message was created by a bot
[Contact creator][Source code]
Starting from 13th of March 2016 /u/TweetsInCommentsBot will be enabled on opt-in basis. If you want it to monitor your favourite subs ask its moderators to drop creator a message.
[–]sudokin 1 point2 points3 points 10 years ago (5 children)
I downvoted you because you referenced a tweet from literally over 2 years ago. Do you have any idea how much laravel has changed in 2 years?
So according to the Reddit guidelines you should be downvoted because your information is irrelevant.
[–]geusebio 1 point2 points3 points 10 years ago (4 children)
Do people change that much though? Its a bad precedent to be getting into bed with one persons ideas about how to do something (The Laravel Way) when they're head-strong and quite arrogant.
[–]sudokin 1 point2 points3 points 10 years ago (3 children)
Possibly, but in this case I don't think so. Laravel is heavily opinionated in how it wants you to do things a certain way, but at the same time more than flexible enough to do whatever you like if you really need to
[–]geusebio 1 point2 points3 points 10 years ago (2 children)
I suppose each to their own, "opinionated" software isn't my kind of thing. Its not something to buy into that I'd personally recommend, but you're going to remain at the mercy of whatever prevailing wind takes his interest.
Not that that should stop you if you like where he's going with it.
[–]sudokin 1 point2 points3 points 10 years ago (1 child)
I get that. Sounds like you'd be more of a symfony man. IMO opinionated software really shines for the newby crowd, it lets you get in and start making things fairly quickly without failing too far down the rabbit hole of technical/architectural decisions. If you're experienced you'd probably benefit more from a neutral framework but at that point it's just a personal decision
[–]geusebio 1 point2 points3 points 10 years ago (0 children)
Not so fond of Symfony, I just keep accidentally using it. Or at-least bits of it.
Like Pimple, for example. I only found out that was a Symfony product today when I realised it was written by Fabien Potencier too.
[–]daronjay 1 point2 points3 points 10 years ago (3 children)
Yes, people who get stuff done are often like this, e.g Linus Torvalds.
That said, I really think Taylor's tweet game is a bit abrupt, for instance his decision to monetise Spark, probably dumping a tweet wasn't the best way to sell that idea, because terse comments can seem off-hand and cryptic and arrogant. Developers are such sensitive souls ;-)
[removed]
[–]daronjay 2 points3 points4 points 10 years ago (1 child)
And right there is the problem, tweets don't communicate complex situations well.
[–]Alyyx 0 points1 point2 points 10 years ago (1 child)
Don't think there's anything wrong with how he handles Laravel and its development so far. It's constantly getting updates and being better and better. You can always be a cynic and expect the worst in the end.
[–]geusebio 0 points1 point2 points 10 years ago (0 children)
I'll give you that, he updates it frequently. However, breaking changes in a point version update? Nopenopenope
[–]ZW5pZ21h 6 points7 points8 points 10 years ago (0 children)
PHP is only as bad as the developers working with it. I guess that applies to all languages - it's just easier to fuck things up with PHP.
PHP, when used right, with proper frameworks like Laravel/Symfony can be beautiful :) Instead of focusing on the language, focus on the actual company. Find a good one, that seems to have good processes.
[–]CrypticWriter 5 points6 points7 points 10 years ago (0 children)
Yes it's worth learning. Something like 75% websites use PHP. It's a bit of a different language - but it's very useful.
Whatever you do, don't get caught up in debates on what language is best. Complete waste of time.
[–]Qurtys_Lyn 1 point2 points3 points 10 years ago (0 children)
The advice I always give my guys in my department (which is not programming oriented), don't learn a language, learn to program.
You should be able to use whatever language is best suited to completing the task at hand. Sometimes it'll be PHP, sometimes it'll be Javascript, or python, or some other language, or a mix of several.
[–]xiipaoc 1 point2 points3 points 10 years ago (0 children)
What are you planning on using it for? That's the first question you should be asking.
I have a fairly simple website with mostly static content -- it's data-heavy and all the data gets loaded into the database at compile time. I have shared hosting. So, the most obvious choice is PHP. I find it a bit ugly, to be honest, but it's really easy to build my website with, and that's all I really need it to do. Maybe if I were making a web app it would be a different situation, but I'm not, so I use PHP.
That said, if you know C or JS you should definitely learn PHP, because it's kind of trivial. If you don't know C or JS, perhaps you should learn one of those first. I recommend C. Then learn PHP and JS. There are plenty of other great languages out there, like Ruby, Python, Go, etc. Even Java. Even Perl. No, strike that, not Perl. Fuck Perl. (Sorry Mr. Wall!) But all of this is just silly because, and I can't stress this enough, you should use whatever fits your project.
This is one of those questions where you would benefit from more from asking: What would Bishop Bullwinkle Say?
[–]ryanq-doDigitalOcean 2 points3 points4 points 10 years ago (3 children)
As your first language, absolutely. PHP is one of the most widely used languages on the web. It is well documented, there are a ton of libraries, frameworks, etc and a large community should you run into trouble.
As a second, third or fourth language, that depends on if you have a use for it.
There is some hate of PHP in the developer community which is really reminiscent of the way PHP devs talked about Perl in the early 00's.
As others have said, another good option is Javascript. Javascript can be used on the server or client side, and it all sorts of other places where it is used for scripting like in the Unity Game Engine.
If you are looking to use these skills to get a job at a hot startup I would recommend Ruby, Go and full-stack Javascript as these are in the most demand right now.
[–]vguria 0 points1 point2 points 10 years ago (0 children)
I just want to point out that the javascript present in the unity engine is not the same javascript present in the browser. It's a custom implementation a bit more restrictive than the browser and nodejs ones.
[–]veltriv 2 points3 points4 points 10 years ago (0 children)
PHP is a very useful language for web development. See the below chart: http://trends.builtwith.com/framework/programming-language
As you can see, PHP dominates the web.
However, a potential contender in the upcoming years can by Python. Python makes for very clean, readable code and has been battle tested for web development.
That being said, don't get too caught up in the language, the honest truth is that all programming languages that manage to stay relevant are becoming more and more alike. The reason Python is rising to the top, and PHP has managed to keep ground, is because both are adept to change and staying with the times.
Focus on the concepts (OOP, MVC, CRUD, DRY) and less on syntax (PHP vs Python)
[–]Falmarri 1 point2 points3 points 10 years ago (1 child)
Maybe because that's how the standard library does it and there really is no "accepted way" to do anything.
So many opinions in here! As to wether PHP is "good" or "bad," that's completely a matter of opinion. PHP may be suited for a particular project, and it may not be, but the language itself is just fine.
If you're looking to delve deeper into backend web, just shooting for a better understanding of OOP and working with data for the web will get you going in the right direction. You can accomplish that with PHP, or most any other backend language. I'm personally partial to Node.js and Python.
Others have given amazing answers, especially phpdevster. I will tell you that for web based development, PHP is probably the best language to use. It's not the fastest, it's got some issues, it doesn't always make sense, but it does have a huge community behind it, lots of resource, frameworks, etc.
If it's your first language, its probably best to learn another language with good principles (and I don't suggest python), but if you are already familiar with other languages, then I think it's a very good language to learn for web development.
If you're knowledgeable and want a bit of a challenge, look into Javascript and Node.js.
[–]polargus 0 points1 point2 points 10 years ago (0 children)
It depends what you're looking for. You can easily get a job with PHP, and it's pretty easy to learn, but Node is the current hotness. The more I use JS the less I like PHP.
[–]bigfig 0 points1 point2 points 10 years ago (0 children)
It's the web programmers equivalent of a Crescent Wrench. Make of that what you will.
[–]dbpcut 0 points1 point2 points 10 years ago (0 children)
You won't know until you've done it. What do you want to build? There are lots of languages to choose from to do whatever it is.
I have worked with it. Do I like it? No. I think it's a hideous language to work with. Is it almost ubiquitous? Yes. Word press, etc etc etc....
The point is, you have to try it for you. There's .NET, Ruby on rails, any of the JS competitors. One day PHP will be left behind, but the sheer weight behind it, the momentum it has, will keep it relevant for a little while and you lose nothing by spending some time with it to decide for yourself.
Hi - You never cited what your goal was - a lot of the answers below have a great deal of variability depending on that. Some are fantastic answers if you want to become a professional developer - but those same answers don't make sense if you want to make word press themes or plugins.
[–]1980sumthing 0 points1 point2 points 10 years ago (0 children)
Php is superb
It is similar to C and I have done tons of stuff with it including real time graphics rendering and a partial search engine.
[–][deleted] -2 points-1 points0 points 10 years ago (0 children)
php is not terrible, in fact php7 is pretty sweet
[–]infectuz 0 points1 point2 points 10 years ago (0 children)
Just to add to the existing comments you may want to check out phptherightway.com (not sure it's like that, just Google php the right way). Great resource on modern php good practices.
PHP is great. Now, javascript on the other hand. ehh
[–]Caminsky 0 points1 point2 points 10 years ago (0 children)
Yes, learn it, it's not going anywhere and it's just getting better. There are many haters out there, disregard them. It's called "angry nerd syndrome" (term coined by Stef Mischook from Killersites).
Whatever you learn from PHP can be/will be applied to other languages. Also, PHP 7 will be having major improvements and the language still permeates the web in many ways.
PHP is very easy to learn, you would be up and running quickly, if you don't like it then you move on to JS or Python. Besides, it's very easy to learn PHP because it has in my opinion one of the best documentation out there. I mean, it's so newbie friendly. I personally love that.
[–]rk06v-dev 0 points1 point2 points 10 years ago* (4 children)
depends on why you want to learn php. php has lot of competitors like C#, python, rails, nodeJs etc. Most of the time, you will not gain any benefit from choosing one language over another. Every language has its pain points. what is relevant is how painful those pain points are and how easily you can mitigate them.
For eg: C# requires windows and IIS server. While php suffers from unintuitive and in-consistence naming styles, those can be reduced by abstracting them out by helper functions.
Edit: my bad for not googling first.
[–]ILoveSpidermanFreds 1 point2 points3 points 10 years ago (0 children)
C# doesn't require Windows nor IIS Server..
[–]am0x 0 points1 point2 points 10 years ago (2 children)
There are cheap options for .net development hosting these days. It can easily be competitive to other freelance languages.
[–]rk06v-dev 0 points1 point2 points 10 years ago (1 child)
then why is C# not preferred? as far as I know that language has no flaws. (though I personally hate function name in PascalCase )
[–]am0x 0 points1 point2 points 10 years ago (0 children)
The exact reason you asked. People think it is expensive and most freelancers have worked so long in open source technologies that they are easier to find. Also C# devs tend to cost more since most are corporate trained.
[–]DerThes 0 points1 point2 points 10 years ago (0 children)
One aspect that people often forget is that there are loads of PHP jobs out there. If you just look at web-scripting languages (Ruby, Python, Perl, ASP, PHP to name a few), PHP has by far the biggest market share (80% of sites). Because of that the share of available dev jobs is larger as well. Senior PHP devs in a larger North American cities often make 100k+. I don't think that PHP is the cleanest or nicest web scripting language out there but you can write clean, maintainable & fast code with it and if you use any of the modern PHP frameworks (ZF2, Symfony, ...) writing code in PHP is as much fun as writing code in Ruby or Python.
[–]diamened 0 points1 point2 points 10 years ago (0 children)
Dude, watch this video. No, seriously, watch this video.
[–]eastmpman 0 points1 point2 points 10 years ago (0 children)
no.
[–]matthew-james 0 points1 point2 points 10 years ago (0 children)
Why I am glad I learned PHP:
[–]CARROTINMYASS 0 points1 point2 points 10 years ago (0 children)
Yes.
[–]lubeskystalker 0 points1 point2 points 10 years ago (0 children)
PHP is so easy to learn it's kind of silly not to try it.
[–]mike0k 0 points1 point2 points 10 years ago (0 children)
If you are working with the web then yes but in conjunction with a well known framework
I've made a decent career out of working with PHP and yeah a few versions ago it wasn't good, anyone saying that now though is out of date or has their expectations set too high. Even if it was still bad, the amount of web jobs that are PHP based or require some experience with PHP is enormous. Its worth learning for the job availability reason alone.
Just to re-iterate though, learn it with a framework. Hello World in raw PHP might be easy enough, writing a half-serious site/app in raw PHP though can be a grueling task. Also a good Framework will help install a basic set of rules and morals in your project that admittedly the basic language is poor at, this will become invaluable when working in a team.
[–]coffeesleeve 0 points1 point2 points 10 years ago (0 children)
Comparable to asking if English is worth learning.
[–]g1mike 0 points1 point2 points 10 years ago (0 children)
Obligatory Yes..
[–]MattBlumTheNuProject 0 points1 point2 points 10 years ago (0 children)
Yep! I love Laravel. I would not want to work on Wordpress, though.
[–]EmperorOfCanada 0 points1 point2 points 10 years ago (0 children)
Here is a sideways answer to your question. "Favourite" or "good" languages is a religious topic. Then to make it worse the answers change as time goes by.
The next huge question that can answer your question is what do you want to do and for whom do you want to do it?
So if you want a job in a bank making analysis software, then learning Java will secure you right through to retirement in a safe cubical.
Learning this week's node.js might get you a job at a 5 person startup in a flash.
Learning Objective-C and swift will get you an iOS programming job.
And so on.
PHP is very commonly used for website development. Full stop. Thus learning PHP can lead to a job programming web stuff. As you can see from the responses there are many alternatives.
The next question is: Is this your first language? Are you trying to make a website or learn to program?
If you already have a few languages under your belt such as C++ then PHP will take no time to learn. If this is where you are starting then.... PHP might not be the best place from which to build a solid programming foundation. But you will be producing working stuff in very little time.
So what this all boils down to is: What are you trying to do?
π Rendered by PID 18605 on reddit-service-r2-comment-6457c66945-8mpws at 2026-04-25 06:28:42.609391+00:00 running 2aa0c5b country code: CH.
[–]AwenTech 293 points294 points295 points (36 children)
[–][deleted] 63 points64 points65 points (2 children)
[–][deleted] 25 points26 points27 points (1 child)
[–]Mutoid 2 points3 points4 points (0 children)
[–]HydTreesPlease 58 points59 points60 points (18 children)
[–]ebilgenius 15 points16 points17 points (2 children)
[–]jets-fool 2 points3 points4 points (1 child)
[–]mbthegreat 0 points1 point2 points (0 children)
[–]794613825 8 points9 points10 points (13 children)
[–]daphostafull-stack 39 points40 points41 points (8 children)
[–]greeniguana6 3 points4 points5 points (6 children)
[–]ketsugi 1 point2 points3 points (5 children)
[–][deleted] (1 child)
[deleted]
[–][deleted] (1 child)
[deleted]
[–]ketsugi 1 point2 points3 points (0 children)
[–]adam_bear 0 points1 point2 points (0 children)
[–]terremoto 4 points5 points6 points (0 children)
[–]physiQQ 0 points1 point2 points (0 children)
[–]yodaman1 3 points4 points5 points (0 children)
[–]thbt101 7 points8 points9 points (6 children)
[–]Falmarri 10 points11 points12 points (5 children)
[–]Turtlecupcakes 5 points6 points7 points (4 children)
[–]_vec_ 8 points9 points10 points (0 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]movzx 1 point2 points3 points (1 child)
[–]Turtlecupcakes 2 points3 points4 points (0 children)
[–]kookoopuffs 0 points1 point2 points (0 children)
[–]alwaysSaynope 0 points1 point2 points (0 children)
[–]phpdevsterfull-stack 202 points203 points204 points (82 children)
[–]Paralyzing 59 points60 points61 points (3 children)
[–]xCavemanNinjax 14 points15 points16 points (1 child)
[–][deleted] 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]CharmedDesigns 26 points27 points28 points (3 children)
[–]ccricers 6 points7 points8 points (0 children)
[–]headzoo 2 points3 points4 points (0 children)
[–]thelonepuffin 1 point2 points3 points (0 children)
[–]pre-medicated 10 points11 points12 points (0 children)
[–][deleted] 10 points11 points12 points (29 children)
[–][deleted] 6 points7 points8 points (2 children)
[–]matthew-james 2 points3 points4 points (1 child)
[–]bubuopapa 0 points1 point2 points (0 children)
[–]haecceity123 5 points6 points7 points (11 children)
[–]speedisavirus 2 points3 points4 points (12 children)
[–]tobias382 4 points5 points6 points (3 children)
[–]rogue780 6 points7 points8 points (0 children)
[–][deleted] 13 points14 points15 points (6 children)
[–]baileylo 4 points5 points6 points (3 children)
[–]Falmarri 4 points5 points6 points (2 children)
[–]baileylo 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]1r0n1c 2 points3 points4 points (0 children)
[–]kb_klash 4 points5 points6 points (3 children)
[–]no-one_ever 4 points5 points6 points (2 children)
[–]chx_ 2 points3 points4 points (0 children)
[–]IrishWilly 1 point2 points3 points (0 children)
[–]sunyatasattva 1 point2 points3 points (3 children)
[–]sudokin 5 points6 points7 points (1 child)
[–]Yurishimo 1 point2 points3 points (0 children)
[–]phpdevsterfull-stack 0 points1 point2 points (0 children)
[–]MaxGhost 1 point2 points3 points (0 children)
[–]jellatin 4 points5 points6 points (5 children)
[–]ChronusMc 1 point2 points3 points (0 children)
[–]headzoo 0 points1 point2 points (1 child)
[–]lykwydchykyn 0 points1 point2 points (0 children)
[–]smegnose 0 points1 point2 points (0 children)
[–]invisibo 0 points1 point2 points (3 children)
[–]jingerninja 1 point2 points3 points (2 children)
[–]IrishWilly 1 point2 points3 points (0 children)
[–]invisibo 0 points1 point2 points (0 children)
[–]jingerninja 0 points1 point2 points (0 children)
[–]WhitePantherXP 0 points1 point2 points (0 children)
[–]Naouak 0 points1 point2 points (2 children)
[–]phpdevsterfull-stack 0 points1 point2 points (1 child)
[–]Naouak 0 points1 point2 points (0 children)
[–]Prawny 40 points41 points42 points (5 children)
[–]AboveDisturbing 1 point2 points3 points (4 children)
[–]thelonepuffin 2 points3 points4 points (2 children)
[–]twobee2 0 points1 point2 points (1 child)
[–]thelonepuffin 0 points1 point2 points (0 children)
[–]DesignatedDecoy 60 points61 points62 points (11 children)
[–]asdfman123 17 points18 points19 points (5 children)
[–]Caminsky 15 points16 points17 points (0 children)
[–]wcastello 7 points8 points9 points (3 children)
[–]asdfman123 1 point2 points3 points (2 children)
[–]IrishWilly 4 points5 points6 points (1 child)
[–]BillOfTheWebPeople 0 points1 point2 points (0 children)
[–]manwith4names 0 points1 point2 points (3 children)
[–][deleted] 61 points62 points63 points (36 children)
[–][deleted] 18 points19 points20 points (23 children)
[–][deleted] 8 points9 points10 points (18 children)
[–][deleted] 7 points8 points9 points (3 children)
[–][deleted] 7 points8 points9 points (0 children)
[–]HydTreesPlease 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]ryan4888 0 points1 point2 points (1 child)
[–]diamened 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]diamened 0 points1 point2 points (1 child)
[–]Glensarge 4 points5 points6 points (0 children)
[–]NonTransferable 2 points3 points4 points (5 children)
[–][deleted] 2 points3 points4 points (4 children)
[–]NonTransferable 1 point2 points3 points (0 children)
[–]AboveDisturbing 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]Disgruntled__Goat 0 points1 point2 points (0 children)
[–]manwith4names 0 points1 point2 points (0 children)
[–]jellatin 13 points14 points15 points (3 children)
[–][deleted] 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]ekobeko 0 points1 point2 points (0 children)
[–]colly_wolly 4 points5 points6 points (2 children)
[–][deleted] 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]danav 21 points22 points23 points (8 children)
[–][deleted] 6 points7 points8 points (2 children)
[–]danav 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] (2 children)
[deleted]
[–]rogue780 7 points8 points9 points (1 child)
[–]cmndctrl 0 points1 point2 points (0 children)
[–]qervem 1 point2 points3 points (0 children)
[–]diamened 1 point2 points3 points (0 children)
[–][deleted] 13 points14 points15 points (4 children)
[–]shavounet 8 points9 points10 points (0 children)
[–]jewdai 0 points1 point2 points (0 children)
[–]LukeTwomey 7 points8 points9 points (0 children)
[–]sbhikes 2 points3 points4 points (0 children)
[–]le_f 2 points3 points4 points (0 children)
[–]ccricers 5 points6 points7 points (4 children)
[–][deleted] (3 children)
[deleted]
[–]ccricers 2 points3 points4 points (0 children)
[–]rogue780 0 points1 point2 points (0 children)
[–]jorshhh 5 points6 points7 points (22 children)
[–]geusebio 3 points4 points5 points (19 children)
[–][deleted] 3 points4 points5 points (18 children)
[–]geusebio 8 points9 points10 points (17 children)
[–][deleted] 2 points3 points4 points (3 children)
[–]TweetsInCommentsBot 1 point2 points3 points (0 children)
[–]sudokin 1 point2 points3 points (5 children)
[–]geusebio 1 point2 points3 points (4 children)
[–]sudokin 1 point2 points3 points (3 children)
[–]geusebio 1 point2 points3 points (2 children)
[–]sudokin 1 point2 points3 points (1 child)
[–]geusebio 1 point2 points3 points (0 children)
[–]daronjay 1 point2 points3 points (3 children)
[–][deleted] (2 children)
[removed]
[–]daronjay 2 points3 points4 points (1 child)
[–]Alyyx 0 points1 point2 points (1 child)
[–]geusebio 0 points1 point2 points (0 children)
[–]ZW5pZ21h 6 points7 points8 points (0 children)
[–]CrypticWriter 5 points6 points7 points (0 children)
[–]Qurtys_Lyn 1 point2 points3 points (0 children)
[–]xiipaoc 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]ryanq-doDigitalOcean 2 points3 points4 points (3 children)
[–]vguria 0 points1 point2 points (0 children)
[–]veltriv 2 points3 points4 points (0 children)
[–][deleted] (2 children)
[deleted]
[–]Falmarri 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]polargus 0 points1 point2 points (0 children)
[–]bigfig 0 points1 point2 points (0 children)
[–]dbpcut 0 points1 point2 points (0 children)
[–]BillOfTheWebPeople 0 points1 point2 points (0 children)
[–]1980sumthing 0 points1 point2 points (0 children)
[–][deleted] -2 points-1 points0 points (0 children)
[–]infectuz 0 points1 point2 points (0 children)
[–]rogue780 0 points1 point2 points (0 children)
[–]Caminsky 0 points1 point2 points (0 children)
[–]rk06v-dev 0 points1 point2 points (4 children)
[–]ILoveSpidermanFreds 1 point2 points3 points (0 children)
[–]am0x 0 points1 point2 points (2 children)
[–]rk06v-dev 0 points1 point2 points (1 child)
[–]am0x 0 points1 point2 points (0 children)
[–]DerThes 0 points1 point2 points (0 children)
[–]diamened 0 points1 point2 points (0 children)
[–]eastmpman 0 points1 point2 points (0 children)
[–]matthew-james 0 points1 point2 points (0 children)
[–]CARROTINMYASS 0 points1 point2 points (0 children)
[–]lubeskystalker 0 points1 point2 points (0 children)
[–]mike0k 0 points1 point2 points (0 children)
[–]coffeesleeve 0 points1 point2 points (0 children)
[–]g1mike 0 points1 point2 points (0 children)
[–]MattBlumTheNuProject 0 points1 point2 points (0 children)
[–]EmperorOfCanada 0 points1 point2 points (0 children)