TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

PHP 8.1.0

335 点作者 AegirLeet超过 3 年前

20 条评论

firefoxd超过 3 年前
I&#x27;ve been using PHP since 5.x. Often had to work on older 4.x web apps. I find it interesting when I read people saying &quot;PHP has come a long way. It&#x27;s a proper language now, etc.&quot;<p>If you work long enough with a language and figure out most its quirks, it&#x27;s a breeze. It&#x27;s nice that they are adding all these new features, but they are hardly what makes it or break it for me.<p>Here is the one features that is taken for granted in &quot;modern stacks&quot;:<p>Edit file -&gt; Alt+tab ctrl+R. Oops, Alt+tab fix -&gt; Alt+tab ctrl+R.<p>When debugging I can do that 50 times a minute. With my react app, I can do it maybe 5 times a minute. With my golang app I&#x27;m lucky if I can do it twice a minute.
评论 #29346669 未加载
评论 #29345291 未加载
评论 #29344937 未加载
评论 #29345469 未加载
评论 #29345742 未加载
评论 #29348591 未加载
评论 #29347899 未加载
评论 #29348027 未加载
评论 #29348879 未加载
评论 #29347661 未加载
评论 #29348767 未加载
评论 #29348461 未加载
评论 #29346952 未加载
评论 #29345042 未加载
评论 #29345834 未加载
评论 #29348478 未加载
评论 #29344978 未加载
评论 #29346802 未加载
评论 #29345451 未加载
pachico超过 3 年前
Everyone laughing at PHP hasn&#x27;t tried it for years, I&#x27;d bet. It started clumsy, true, but it became a solid and quite elegant way of doing things.<p>And by things I don&#x27;t mean just web development.<p>The current limitations I see in PHP is that there is not an official multi-core coroutines solution.
评论 #29345177 未加载
评论 #29344857 未加载
评论 #29345265 未加载
评论 #29347102 未加载
评论 #29348213 未加载
评论 #29349519 未加载
评论 #29347584 未加载
评论 #29345986 未加载
评论 #29348055 未加载
评论 #29345280 未加载
评论 #29344723 未加载
评论 #29344835 未加载
评论 #29344771 未加载
tdrdt超过 3 年前
I use C#, Javascript and PHP a lot.<p>PHP always wins when it comes to deployment and productivity. In my opinion that&#x27;s the power of PHP.<p>It&#x27;s also versatile. I used it for small projects, multi-million € projects, COM-port communication, API communication, prototyping and what not.<p>The syntax is not great, but to me PHP is this multi-tool that just gets the job done and will run reliable for years.
simonw超过 3 年前
Fibers &quot;allow blocking and non-blocking implementations to share the same API&quot;<p>That&#x27;s an interesting contrast to Python where the need to use &quot;value = await fn()&quot; v.s. &quot;value = fn()&quot; depending on whether or not that function is awaitable causes all kinds of API design complexity, all the way up to the existence of tools like <a href="https:&#x2F;&#x2F;github.com&#x2F;python-trio&#x2F;unasync" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;python-trio&#x2F;unasync</a> which can code-generate the non-async version of a library from the async version.
评论 #29344646 未加载
评论 #29344847 未加载
评论 #29345578 未加载
josephcsible超过 3 年前
PHP has a lot of warts, and I mean <i>a lot</i>, but one thing I really like about PHP that virtually no other Web languages offer is that I can just drop code in my Web server&#x27;s document root, go to that path in my browser, and it runs, without needing to deal with frameworks, boilerplate, compiling, etc.
评论 #29347299 未加载
评论 #29347521 未加载
shruubi超过 3 年前
As someone who has worked in a lot of languages and now works in PHP, I think that while PHP still has some of the same warts it did in the old days, I am also understanding that given PHP is, for better or worse, a fundamental piece of web infrastructure, and that providing an upgrade path while also ensuring that they don&#x27;t just break a large chunk of the web is less a matter of &quot;software conservatism&quot; and more a responsibility of the dev team.<p>And, if we&#x27;re being honest, the reality is that for that chunk that would break, most of them would either not have a developer on hand to fix it, or would be what I call a &quot;Wordpress cowboy&quot; who has a WP site they set up five years ago that they never update, and the sum total of their development experience is installing various WP plugins until the site vaguely does what they want it to do.<p>It&#x27;s hard, because on one hand, if we didn&#x27;t have things like Wordpress, then PHP would be in a position to undertake more breaking changes that would overall give the language and its libraries the much needed quality improvements. On the other hand, without things like Wordpress, it does become somewhat questionable as to whether PHP would have survived the dark days of PHP4 and the early versions of PHP5.<p>In saying all that, the work that the dev team have done to add great features and solid performance, alongside the community which has done a lot of good things like PSR&#x27;s and the PHP League libraries to me, is one of the key things that makes PHP still an attractive environment to work in.
评论 #29346004 未加载
评论 #29345869 未加载
bilal4hmed超过 3 年前
I haven&#x27;t written PHP since the 5.0 release but its amazing to see how it has grown over the years. Seems to have picked up a few nice things and is still enjoying usage even today.
评论 #29346235 未加载
rbanffy超过 3 年前
Genuinely curious: who here thinks PHP is a good choice for a new project and also has experience with other languages such as Scala, Kotlin, Python, or JavaScript and their respective web frameworks?
评论 #29346141 未加载
评论 #29346224 未加载
评论 #29345937 未加载
评论 #29349828 未加载
评论 #29347176 未加载
评论 #29347228 未加载
pdenton超过 3 年前
Question: does class_exists still return TRUE when given the QCN to an enum?<p>Because it&#x27;s not possible to instantiate an enum, if one appears in the constructor of a class it&#x27;ll break auto-wiring. I&#x27;ve written my own IoC containers and one fundamental assumption in them is that when class_exists returns true, it is what it says on the tin. Using a specialized factory would still be possible. I wonder if other containers would break on seeing enums as well, but I hope they fixed this because it&#x27;s not mentioned in the breaking changes. The documentation for class_exists doesn&#x27;t mention enum.
评论 #29346693 未加载
评论 #29345843 未加载
maxpert超过 3 年前
Fibers!!! Who wants to bet we are a few releases away from async&#x2F;await syntax now. Giving credit where it’s due Microsoft with C# pioneered the syntax and every classic (including a few modern) language has adopted the syntax.<p>I believe we are a few steps away from a fully builtin production ready server and db connection support.
评论 #29345908 未加载
评论 #29348553 未加载
评论 #29347882 未加载
laacz超过 3 年前
Judging from the comments, it looks that many negations stem from the &quot;old PHP&quot;. I&#x27;ve been developing with PHP since late 90s. Oh, boy, I&#x27;ve created a lot of bad code during all those years. However, when doing new year&#x27;s retro, there has not been a single time I would be able to say that PHP has not evolved. As well as my code.<p>Modern PHP might not have all the shiny features other high profile languages have, but it&#x27;s getting there. It&#x27;s slower than many would like because of much debt and legacy. But it&#x27;ll get there.<p>Also, you can write shitty code in any language. I would bet that, if back then python was as easy to deploy, as PHP, we&#x27;d now be fighting about that the same way as we are about PHP.
marcodiego超过 3 年前
Still holding the web. Happy to see it is continually evolving.
评论 #29344766 未加载
VMtest超过 3 年前
Reading some comments here and it does confuse me<p>Promises, async and await in javascript, coroutines and threads in kotlin, fibers in some language runtime (including this php 8.1 [0]), single process (nodejs), multi-process(php-fpm worker), single-thread, multi-thread, goroutines in go, multi-core coroutines<p>Googling the definitions and x vs y situation helps a little, the main confusion to me is why some people want this xyz feature in a language runtime and not the other, the pros and cons are seriously so confusing<p>I have probably used several, like promises, async, await, like others said async would be implement on fibers [1] (is php 8.1 implementation same as V8,spidermonkey,javascriptcore? or any other language runtime). And I have tried to understand kotlin coroutines as well<p>modern times to run php, people would use php-fpm with nginx, it is running multiple worker (single) process, so why would anyone [2], [3] wants multi-core coroutines in it? What does it even mean?<p>Writing this out ease my mind a bit yea, need to be able to communicate the confusion instead of just saying &quot;programming is difficult&quot;<p>[0]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29343773" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29343773</a><p>[1]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29344427" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29344427</a><p>[2]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29344704" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29344704</a><p>[3]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29345986" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29345986</a>
评论 #29347314 未加载
评论 #29348199 未加载
tarokun-io超过 3 年前
I haven&#x27;t written PHP in years but I get the feeling from this release that they are taking inspiration from TypeScript and JavaScript.
评论 #29345092 未加载
评论 #29344405 未加载
评论 #29344401 未加载
评论 #29344449 未加载
fart32超过 3 年前
I sometimes wish I&#x27;d never learnt C#. I love property accessors, as I consider properties to be a part of public API and in PHP, there&#x27;s no nice way around it other than the boilerplate getters and setters.<p>Also I hope we&#x27;ll get generics at some point. I know there are some issues with their implementation, but even non-runtime enforced generics would be better then relying on a docBlock annotation.<p>Enums are neat, though.
评论 #29358391 未加载
EGreg超过 3 年前
What is this?<p><pre><code> class User { &#x2F;** * @Assert\All({ * @Assert\NotNull, * @Assert\Length(min=5) * }) *&#x2F; public string $name = &#x27;&#x27;; } PHP 8.1 class User { #[\Assert\All( new \Assert\NotNull, new \Assert\Length(min: 6)) ] public string $name = &#x27;&#x27;; }</code></pre>
评论 #29344674 未加载
评论 #29344662 未加载
评论 #29344703 未加载
评论 #29345894 未加载
ittan超过 3 年前
Excuse my intrigue. Is this topic biased to language design or experience using php?
jdjdjrj超过 3 年前
Say what you want about PHP, but here we are decades later. I&#x27;m still using it, it still works, and it&#x27;s still getting updated and improved.
评论 #29345662 未加载
评论 #29348368 未加载
lifeplusplus超过 3 年前
PHP devs make less and have to learn JS anyways.
s-xyz超过 3 年前
Who is still using PHP anno 2021?
评论 #29345149 未加载
评论 #29345334 未加载
评论 #29345507 未加载
评论 #29344750 未加载
评论 #29344952 未加载
评论 #29344816 未加载
评论 #29347001 未加载
评论 #29346503 未加载
评论 #29352621 未加载