Live data from Hacker News

PHP 7 Released

github.com

101–110 of 317 posts

Re: PHP 7 Released

#101
post #63
post #7

PHP 7 makes life a lot better for PHP devs in many ways but one awesome thing is it obsoletes bunch of out-of-date tutorials by finally removing the old Mysql extension \o/ http://php.net/manual/en/migration70.removed-exts-sapis.php I actually met a young aspiring web developer who still learned DB-access with mysql_* functions. I urged him to switch to a sane framework like Laravel. Oh boy he was happy in a month an…

> I urged him to switch to a sane framework like Laravel ...why didn't you taught him about PDO, so he can start with something more universal, not tied to one particular framework that happens to be popular nowadays?! Then he can learn whichever OR/DM or DAL he might like need (Eloquent, Doctrine, Redbean, IdiORM/Paris etc.), and also be able to pop the hood and debug it when needed. I never get it why so many other…

I could've done that but that wouldn't have taught the same things. PDO is awesome but requires deeper level of understanding (for a beginner), which may increase the frustration and may end up returning back to the mysql_query and co.

It's easier point to framework that's already using PDO and and making sane defaults and solving bootstrapping problems. Once you've learned bunch of new concepts like ORM in one framework, it's easy to understand other ORs and be able to compare it to DMs.

My own experience with Laravel has been really positive. Actually I was thinking about creating something similar until I learned about Laravel, so it solved lots of existing annoyances regarding PHP coding for me.

Everybody needs to start somewhere and I believe that by nudging towards Laravel, my young friend'll learn more in the long run and in the meantime can concentrate on making services instead of writing home grown PDO helpers and custom routing libraries. They are problems that have been solved already multiple times.

Also, Symfony and Laravel communities are encouraging and teaching about the better ways of doing things so that'll help him in the long run.

In many small project it's more fun and more easier to use $favorite_framework instead of searching for reinvented wheel. There are cases when it's better to do more custom solutions but for many cases frameworks are just awesome

Re: PHP 7 Released

#102

Stuff like this hurts: https://www.drupal.org/node/2454439

Of note: that issue has been ongoing for months, and most of the issues that were found were fixed in PHP core within a few days/weeks. Drupal 8's test suite even caught one regression that delayed the PHP 7.0.0 final release a few weeks!

Most modern PHP apps will work on PHP 7.0.0 with little or no extra effort, but if you have a large legacy app, and haven't ever turned on error logging, you may need to fix a bunch of deprecated code usage!

Re: PHP 7 Released

#103
post #21
post #7

PHP 7 makes life a lot better for PHP devs in many ways but one awesome thing is it obsoletes bunch of out-of-date tutorials by finally removing the old Mysql extension \o/ http://php.net/manual/en/migration70.removed-exts-sapis.php I actually met a young aspiring web developer who still learned DB-access with mysql_* functions. I urged him to switch to a sane framework like Laravel. Oh boy he was happy in a month an…

I think it's great to point new developers to the right resources. Besides sane frameworks, there are some good starting/best practices guides to help (that are regularly updated), such as: http://www.phptherightway.com https://phpbestpractices.org Also, I would encourage them to look at different frameworks, not just one. It'll help if they later move onto other languages, as they'll be already exposed to different…

Very first part of the tutorial: "Use the Current Stable Version (5.6)"

Re: PHP 7 Released

#104
post #36
post #7

PHP 7 makes life a lot better for PHP devs in many ways but one awesome thing is it obsoletes bunch of out-of-date tutorials by finally removing the old Mysql extension \o/ http://php.net/manual/en/migration70.removed-exts-sapis.php I actually met a young aspiring web developer who still learned DB-access with mysql_* functions. I urged him to switch to a sane framework like Laravel. Oh boy he was happy in a month an…

> I actually met a young aspiring web developer who still learned DB-access with mysql_* functions. I urged him to switch to a sane framework like Laravel. Oh boy he was happy in a month and learned bunch of best practices quickly. There is some middle ground good practice which is using PDO, or even better Doctrine/DBAL . I don't think Laravel's ORM is that good, and the Active Record Pattern is somehow controversia…

Well anything is better than the old and original Mysql extension for PHP. If you Google "PHP MySQL tutorial", there's lots of tutorials teaching still about mysql_connect and mysql_query.

AR is controversial but it is approachable.

In addition, I figure, those old PHP tutorials (code like it's the 2003!) are giving bad example and beginners can't understand the difference or realize that mysql_query + bunch of procedural code per file * 10 can be bad thing.

I should've been a bit more clearer. Laravel taught him bunch of generic best practices (like deployment procedures, GIT, OOP, MVC, etc) and using Laravel Query Builder and/or Eloquent makes the DB code more sane compared to mysql_query.

Laravel isn't the only framework which could've done this but like AR, it's quite beginner friendly :)

Re: PHP 7 Released

#105
post #64

Earlier quoted context omitted.

> Active Record Pattern is somehow controversial. What is controversial about AR?

Mainly how easy it is to have zero clue that you're doing something horrible (SQL performance wise). Not positive that's what parent meant, but that's my guess.

AR works nicely for simple basic queries but everything more advanced should be done with custom queries. That helps a lot :)

Re: PHP 7 Released

#106

Earlier quoted context omitted.

I think the question is why should you bother with PHP at all? It had its time in the history of the web but that time has passed, long, long ago.

Wordpress alone runs 25%+ of all websites. PHP's time is clearly still now. I probably won't bother with PHP, but it can't hurt to keep my idea of what it's like up to date. It's only technology, no need to be fanatical about it.

To be fair, don't just down vote the parent comment because your don't like someone bashing php; it's a pretty reasonable question to ask.

Most people don't actually know that php powers such a large portion of the internet, because globally there's waning interest in php (http://www.tiobe.com/index.php/content/paperinfo/tpci/PHP.ht...) and it's generally dreaded by developers (http://stackoverflow.com/research/developer-survey-2015#tech...).

In all seriousness, why would you get into php at this point?

Do you want to go and work for Wordpress.com? (I mean, heck, they're building node sites now (https://developer.wordpress.com/2015/11/23/the-story-behind-...).

Are there really that many php jobs floating around?

I'm certainly not seeing it.

There are a tonne of 1-click-wordpress-for-$10 companies out there, making $10 websites using it... sure, and certainly, plenty of people use it as a blog; but is there really a professional path for a php developer?

There's no where near the interest in it that there is in engineers using say, java or C#, or heck, even javascript.

I mean, I'm totally down with looking up composer and php classes if you're curious to see what 'modern' php is like, but I certainly couldn't come up with a good reason to do it other than curiosity.

Re: PHP 7 Released

#107

Earlier quoted context omitted.

If you have to look it up anyway, what difference does it make if it's a global or namespaces? If you don't know, you don't know. As such, your point as stated doesn't counteract why polluting global namespaces is a bad thing. There are arguments that could be made (PHP VM specific), but "I didn't ever RTFM and/or retain it" doesn't fly to me personally.

> what difference does it make if it's a global or namespaces? I feel that it's often easier to remember short unique name like str2int than long, deceivingly reasonable name like: System.Web.Script.Serialization.JavaScriptSerializer.Serialize I agree though that array_uniq is same as Array::uniq > why polluting global namespaces is a bad thing. Why is that bad for language wide utility functions? I though global is…

You love continuing to bring up the Java like example, this discussion however is about PHP. PHP will never have namespacing nested like that in the base language, so no point beating that dead horse.

> why is that bad for language wide utility functions?

There's a handful of reasons, but one important one is backwards compatibility with existing codebases (naming collisions).

Re: PHP 7 Released

#109
post #7

PHP 7 makes life a lot better for PHP devs in many ways but one awesome thing is it obsoletes bunch of out-of-date tutorials by finally removing the old Mysql extension \o/ http://php.net/manual/en/migration70.removed-exts-sapis.php I actually met a young aspiring web developer who still learned DB-access with mysql_* functions. I urged him to switch to a sane framework like Laravel. Oh boy he was happy in a month an…

Urge him to switch to a sane language instead. You are doing no one a service by advising them how to make using PHP suck less.

Re: PHP 7 Released

#110

Earlier quoted context omitted.

I think the question is why should you bother with PHP at all? It had its time in the history of the web but that time has passed, long, long ago.

Wordpress alone runs 25%+ of all websites. PHP's time is clearly still now. I probably won't bother with PHP, but it can't hurt to keep my idea of what it's like up to date. It's only technology, no need to be fanatical about it.

Just because a lot of sites run it doesn't mean it's not crap. A lot of companies still host stuff on Windows like it's still 2002, as well.

PHP has no place in modern development.

Post reply on HN