TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

PHP 7.4

288 pointsby velmuover 5 years ago

19 comments

mikeceover 5 years ago
While everyone else (well, me) have their attention on the hippest, newest languages PHP has been steadily improving, getting faster, and still runs a lot of the largest web properties. It wouldn&#x27;t surprise me if before long PHP can be compiled to native binary* complete with a memory efficient, non-blocking web server and performance approaching what Go and dotNetCore can achieve... and the option to emit a &quot;normal&quot; PHP web app that can run anywhere if you don&#x27;t need Facebook-level performance from it.<p>*I realize HipHop PHP did this already but it doesn&#x27;t have it&#x27;s own baked-in web server afaik. I&#x27;m thinking along the lines of compiling down to something small and fast to be deployed to K8S clusters without needing containers for Apache or nginx as part of the setup.
评论 #21658170 未加载
评论 #21657545 未加载
评论 #21658024 未加载
评论 #21658537 未加载
评论 #21658702 未加载
评论 #21658332 未加载
评论 #21660348 未加载
评论 #21659044 未加载
评论 #21659750 未加载
SergeAxover 5 years ago
The most interesting thing about PHP is it is, AFAIK, the most community-driven language today. Go, Python and JavaScript are all under heavy influence of Google, C#, VB.NET and TypeScript is Microsoft&#x27;s turf, Java is Oracle&#x27;s, Rust and WebAssembly - Mozilla&#x27;s.<p>С and С++ are holding their grounds, but they are more and more niche today. Facebook tried to domesticate PHP, but failed spectacularly. So it looks like PHP is most democratic and liberal programming language of today) I am glad it&#x27;s getting steadily ahead.
评论 #21658357 未加载
评论 #21657731 未加载
评论 #21657956 未加载
评论 #21658436 未加载
评论 #21657701 未加载
RadioactiveManover 5 years ago
The praise for arrow functions is surprising. They don&#x27;t enable anything new and their feature - saving a half dozen characters - comes with the cognitive cost of tracking how both types of anonymous functions work and their subtle differences in behavior. It&#x27;s not worth that price.
评论 #21657775 未加载
评论 #21657633 未加载
评论 #21657494 未加载
Aaronmacaronover 5 years ago
I&#x27;ve been waiting so long for this day. Finally arrow functions in PHP! Until now it was extremely cumbersome to use higher-order functions such as array_map() or usort() . This is especially true if you&#x27;re a full stack developer who frequently switches between PHP and JavaScript which has had support for arrow functions for a long time. The hitherto existing anonymous functions are so verbose and it&#x27;s a real pain to bind all closure variables manually.
评论 #21657124 未加载
评论 #21656951 未加载
tyingqover 5 years ago
Pretty big list of new features: <a href="https:&#x2F;&#x2F;www.php.net&#x2F;manual&#x2F;en&#x2F;migration74.new-features.php" rel="nofollow">https:&#x2F;&#x2F;www.php.net&#x2F;manual&#x2F;en&#x2F;migration74.new-features.php</a><p>Happy to see the proc_open() feature of NOT spawning a shell, and interested in the FFI implementation.
theodorejbover 5 years ago
Typed properties and arrow functions are great, but I&#x27;m also happy to see the deprecations in this release. E.g. nested ternary operators without explicit parentheses (such use was almost always a mistake). Full list here: <a href="https:&#x2F;&#x2F;www.php.net&#x2F;manual&#x2F;en&#x2F;migration74.deprecated.php" rel="nofollow">https:&#x2F;&#x2F;www.php.net&#x2F;manual&#x2F;en&#x2F;migration74.deprecated.php</a>. Some of the deprecations pave the way for performance improvements in PHP 8.
评论 #21658810 未加载
jonny383over 5 years ago
Typed properties are well overdue! PHP is almost sexy again...
评论 #21657169 未加载
bilekasover 5 years ago
Praise Jesus Typed properties!!
评论 #21657441 未加载
mpartelover 5 years ago
Having followed and at times heavily used PHP since the 4.x times, its story seems to be that of slowly (and begrudginly?) accepting modern language features like classes, exceptions, lambdas, GC, static typing, etc., sometimes getting things wrong on the first try but still mostly converging towards modernness.<p>That begs the question, what&#x27;s PHP&#x27;s value proposition for new projects? If PHP mostly chases feature parity with Java&#x2F;.NET&#x2F;TypeScript and doesn&#x27;t attempt to do anything better&#x2F;different (like Elm&#x2F;Haskell&#x2F;Rust&#x2F;Go&#x2F;Erlang arguably do), then why choose it?
评论 #21658336 未加载
评论 #21658280 未加载
评论 #21660025 未加载
评论 #21658243 未加载
评论 #21659709 未加载
评论 #21663054 未加载
conradfrover 5 years ago
I guess null coalescing assignment operator will save a lot of typing but I&#x27;m not sure it leads toward a more readable code, especially with ?? and ?: already part of the language.
评论 #21657764 未加载
arkhover 5 years ago
&gt; It is now possible to escape question marks in SQL queries to avoid them being interpreted as parameter placeholders. Writing ?? allows sending a single question mark to the database and e.g. use the PostgreSQL JSON key exists (?) operator.<p>Good.
GrumpyNlover 5 years ago
Why this, can someone please explain.<p>Numeric literals can contain underscores between digits.<p>&lt;?php 6.674_083e-11; &#x2F;&#x2F; float 299_792_458; &#x2F;&#x2F; decimal 0xCAFE_F00D; &#x2F;&#x2F; hexadecimal 0b0101_1111; &#x2F;&#x2F; binary ?&gt;
评论 #21658784 未加载
评论 #21658763 未加载
hc91over 5 years ago
Why is this garbage fire of a language still alive is one of the big mysteries of the universe
agumonkeyover 5 years ago
Another step in the homogeneousness of ~dynamic programming languages. PHP is now near ES6 parity, which was a ml&#x2F;scheme revival.
sexy_seedboxover 5 years ago
Arrow function and spread operator, that&#x27;s so... ES6 :o
评论 #21657135 未加载
评论 #21657080 未加载
samcdayover 5 years ago
There&#x27;s a lot of PHP positivity in the comments. I just want to inject some sobering pessimism in here, as someone who has spent the last 6 months using PHP for the $dayjob, and used to do commercial PHP work back in the PHP5 days.<p>PHP ....<p>... Doesn&#x27;t ship with a production ready webserver. Yes, Python and Ruby also don&#x27;t, but they have easy tools you can reach for (gunicorn, Puma) if you need to run them in a modern deployment stack where a whole nginx isn&#x27;t really necessary.<p>... Doesn&#x27;t have basic collection types in the core language. It&#x27;s 2019 and PHP still thinks it&#x27;s logical for the standard language to throw all Map, Set, List semantics into a single PHP array type. You can install the &quot;phpds&quot; native extension (and polyfill it from Composer) to get some passably usable implementations. But coming from Golang &#x2F; Rust (or hell, even ES2015) I find them frustratingly limited.<p>... Doesn&#x27;t have any sort of threading &#x2F; async support. Even in a modest-scale webapp, this is going to hurt you when you want to do things like deploy PHP as a job queue handler. Or fan out even a trivial number of HTTP-client API calls from a PHP controller in a microservice-y world. The latter can be sort-of achieved with naive hacks like the cURL client concurrency support (Symfony HTTP-client supports it: <a href="https:&#x2F;&#x2F;symfony.com&#x2F;doc&#x2F;current&#x2F;components&#x2F;http_client.html#concurrent-requests" rel="nofollow">https:&#x2F;&#x2F;symfony.com&#x2F;doc&#x2F;current&#x2F;components&#x2F;http_client.html#...</a>) but that&#x27;s a hack at best.<p>... Doesn&#x27;t ship with a debugger out of the box. Even with great tooling like phpstorm IDE, you have to actually rub braincells together to be able to get xdebug installed &#x2F; configured and ready to use.<p>... Has a somewhat decent package manager (Composer). But it doesn&#x27;t ship with the language. Also, it&#x27;s kinda crappy. It&#x27;s painfully slow to do a composer install&#x2F;update on anything larger than a toy project. It has all sorts of weird non-determinism issues (the composer.lock file flails around wildly between runs, changing case of metadata fields, etc).<p>... Has semi-decent static analysis tools (Psalm, phpstan), but they&#x27;re pretty garbage compared to a proper compiler, or the quality of static analysis tools in other dynamic languages like Ruby &#x2F; Javascript.<p>I could keep going. Profiling, code formatter, library ecosystem quality, and so on.<p>Where am I going with this? Honestly, I wish PHP would just die. It has some pros, but overall it&#x27;s a terrible language that has no hope of modernizing enough to be relevant in 2019 and beyond. There&#x27;s plenty of other excellent languages that do a better job in any category that PHP attempts to be good at. The effort being spent to maintain PHP as a language&#x2F;runtime could be better spent on other languages that have made better choices in language design.<p>The developers who have become proficient in PHP, should continue to use their employable skills to maintain existing PHP codebases, but take a bit of time on the side to get proficient with another popular language if not already. And for the love of god, stop starting greenfields projects in PHP! Let it fade away peacefully.
Freegileover 5 years ago
I wonder why they added the &quot;fn()&quot; thing on the left of the array functions.<p><pre><code> Javascript: $square = $x =&gt; $x*$x; PHP : $square = fn($x) =&gt; $x*$x; </code></pre> Probably so that it works inside arrays:<p><pre><code> $a=[fn($x)=&gt;$x*2,fn($x)=&gt;$x*$x]; echo $a[1](5); &#x2F;&#x2F; 25 </code></pre> Well, it also makes it a tad more readable, so I am ok with it.<p>Since we are talking about new features of PHP: Does anybody else wish there were named parameters?<p>I think PHP is pretty complete. It is my favorite language and I don&#x27;t really wish for anything added to it. Except for two things:<p>1: The named parameters of Python:<p><pre><code> def paint(what,color=&#x27;blue&#x27;,tool=&#x27;pen&#x27;,layers=1) ... paint(&#x27;house&#x27;,tool=&#x27;brush&#x27;) </code></pre> 2: The short object Syntax of Javascript:<p><pre><code> city={name: &#x27;Berlin&#x27;, population: 3748000}</code></pre>
评论 #21658222 未加载
评论 #21657958 未加载
评论 #21657894 未加载
评论 #21661566 未加载
评论 #21657965 未加载
评论 #21657920 未加载
评论 #21657913 未加载
评论 #21657936 未加载
评论 #21657933 未加载
pentium10over 5 years ago
For those who want to use on serverless functions the new PHP functionalities there is a way using Cloud Run.
评论 #21657249 未加载
m712over 5 years ago
I have been waiting for a strongly typed mainstream high level language for a long time (TypeScript doesn&#x27;t count because all type information is stripped during runtime). PHP still has a lot of cruft that prevents me from using it in my projects, but the recent updates seem like a step in the right direction. Hope that by PHP 8 the language will have deprecated more of the bad stuff.
评论 #21657525 未加载
评论 #21657466 未加载
评论 #21662072 未加载
评论 #21657046 未加载
评论 #21657250 未加载