PHP 7.3.0 alpha 1 Released
php.net
php.net
What was surprising was how hard I had to dig now, 7 years later to find out how to do things correctly in PHP 7. Searching for what I thought should be fairly common things to do seemed to bring up all of the old articles that I first mislearned from, and it was really hard to find things like what the best way to iterate over a mysql result set was.
Honestly, after putting my 7 years of experience to practice, the final code didn't look half bad, but I don't think I'll ever end up using PHP since it still appears to be very easy to write bad code. Maybe if a definitive guide for how to write good PHP shows up, I'll give it a shot (or maybe I'll just try Hack).
http://www.phptherightway.com is often recommended in my circles.
> We can demonstrate the concept with a simple, yet naive example.
> Here we have a Database class that requires an adapter to speak to the database.
It tries so hard to be java, which seems backward.
The way PHP is evolving is definitely towards the Java world and I think it's the worst decision they could make.
Moved to Go 5 years ago, never looking back.
DI can be heavy or it can be something mostly automagical like in Laravel. That's something I've enjoyed quite a bit. Basically it doesn't that much exist until you start needing special cases.
Quite a big part of the PHP community is gravitating towards Laravel and the new steam it introduced with OOB best practices and "let's try hard to avoid the Java-heaviness". Laravel seems to have quite nice balance between easy for new devs and bunch of powerful concepts when needed. Lots of basic problems solved OOB as well.
https://paragonie.com/blog/2018/01/our-ambitious-plan-make-i...
7 years ago we had Codeigniter, which was also quite good.
I was in the Java world for many years, and found it to be incredibly easy to write 'bad' code. Sure it looked OK, but whenever there was a problem... i would just have people telling me it was 'wrong' and 'bad', but rarely ever any 'good' way to do something, short of entirely rebuilding in someone else's preferred library/framework/stack.
Loads of "well, that never happens to me", "works fine", etc. Was it tomcat? which version? was it one of the 95 dependencies interacting with tomcat in a way no one had ever hit? Oh shit - you're using tomcat? WTF? Glassfish/jetty/jboss are the only 'real' tools to use... etc.
- JSON:
. Added JSON_THROW_ON_ERROR flag. (Andrea)
A blessed day, prior to this, json_decode would simply return null on error.if(null === $data = json_decode($json)) throw new Exception();
Better yet - don't use PHP.
- list() Reference Assignment
https://wiki.php.net/rfc/list_reference_assignment
this allows using list() function for reference assignment instead of just assigning to new variables- Flexible Heredoc and Nowdoc Syntaxes
https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes
This makes using HEREDOC blocks much more friendly looking for spaces/tab usages in codeOther stuff
Just a lot of updates and bugfixes to many extensions
Not only does it let you indent the closing marker, but however much you indent it causes that much white space to be trimmed from the enclosed text. Heredocs are now perfect.
It's amazing a lot of software still support some very old stuff :)
[0] https://insights.stackoverflow.com/survey/2018/#work-salary-...
My impression (based on nothing more than anecdotal industry experience) is that there are far more jobs for PHP globally, and that the average starting salary for a new PHP dev is going to be considerably lower than the average starting salary for a new Go dev.
However, the number of stable senior PHP dev jobs with high salaries is also likely far higher than for Go.
I imagine it's easier to earn more as a new Go developer if you can get a job doing it, but it's easier to steadily get raises as a PHP developer.
Eh, if we're strictly speaking about making money, then Java is the way to go. It'll open up your career opportunities much farther than PHP.
I love how every php upgrades requires me to find mysqli-type crap that breaks all my customers' code.
. Removed support for BeOS. (Kalle)
. Removed support for ODBCRouter. (Kalle)
. Removed support for Birdstep. (Kalle)
So, if your customers are still using BeBoxes, you might have a problem.
. Implemented https://wiki.php.net/rfc/pcre2-migration (Anatol, Dmitry)
For me that's 40% faster on typical regex code.