l14107cb 发表于 2024-10-4 19:00:20

PHP老矣,尚能饭否?


    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-axegupay5k/10252c8cd6a3405184c90e3b3473d994~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728279719&amp;x-signature=BL1QMwgl92A9uLJxecpQWi3In0U%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">撰稿 | 如烟</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">出品 | 51CTO技术栈(<span style="color: black;">微X</span>号:blog51cto)</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">“PHP是世界上最好的语言”,已<span style="color: black;">作为</span>承载程序员黑色幽默的热梗。这门有着三十年历史的编程语言在web时代独享高光,近些年<span style="color: black;">亦</span><span style="color: black;">伴同</span>着“没落”、“将亡”的论调艰难前行。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">近期</span> GitHut 最新<span style="color: black;">颁布</span>的数据<span style="color: black;">表示</span>,<span style="color: black;">研发</span>者在 GitHub 提交的 PR 中,所<span style="color: black;">运用</span>语言为 PHP 的数量逐年下降。</span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/a43de446b0c04b9d8bbe3c7078d94bf9~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728279719&amp;x-signature=hGLdYvpizJbw2YGymVF39enFSy0%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">照片</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-6w9my0ksvp/6c10225bd69f4e848f49bfd8ec205e78~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728279719&amp;x-signature=QtphNDyLJi7DF7UyaCSi0tyqRXw%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">照片</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">细看图表中的曲线不难<span style="color: black;">发掘</span>,过去 4 年,C、C++、Java、Ruby 的曲线都比 PHP 的平坦。<span style="color: black;">因此呢</span>有人直言:“2023 年,PHP 停滞不前”!</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">网友们的评论<span style="color: black;">亦</span>是五花八门,有人并不看好PHP的发展:“<span style="color: black;">非常多</span>系统<span style="color: black;">已然</span><span style="color: black;">再也不</span>支持它,我认为这很能说明问题”;还有人认为PHP不会凉凉:“40% 的网站仍在<span style="color: black;">运用</span> Wordpress,<span style="color: black;">因此呢</span> PHP 仍将存在一段时间。”</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">PHP 陷入停滞的<span style="color: black;">原由</span>是什么?<span style="color: black;">是不是</span>真的大势已去,<span style="color: black;">没法</span>重现当年风采?</span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">1、Web时代,得PHP得天下</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">PHP<span style="color: black;">做为</span>服务器端脚本语言的开山鼻祖,在2000年-2010年经历了最荣耀的十年,<span style="color: black;">亦</span>确实<span style="color: black;">叫作</span>得上是“世界上最好的语言”。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">当时<span style="color: black;">包含</span>淘宝、雅虎、<span style="color: black;">外链论坛: http://www.fok120.com</span>在内的80%的网站都用PHP<span style="color: black;">研发</span>,<span style="color: black;">倘若</span>听说哪家互联网<span style="color: black;">机构</span>的后台<span style="color: black;">不消</span>PHP,都会觉得匪夷所思。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">PHP应Web而生,回顾互联网的发展史,就不难理解PHP盛行的<span style="color: black;">原由</span>。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">Web 1.0时代,互联网内容<span style="color: black;">重点</span>由网站自己生产,用户<span style="color: black;">亦</span>只能<span style="color: black;">经过</span>桌面浏览器上网查看内容,这个<span style="color: black;">周期</span>的业务形态比较简单,单体应用足以应付,不存在高并发等性能问题。上手简单、<span style="color: black;">研发</span><span style="color: black;">快速</span>的<span style="color: black;">优良</span>让PHP变得炙手可热。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">进入Web 2.0时代,随着论坛、博客的<span style="color: black;">显现</span>,用户<span style="color: black;">亦</span>能参与到内容创建中来,<span style="color: black;">引起</span>网站服务器面临前所未有的流量挑战。此时的PHP<span style="color: black;">显出</span>有些力不从心,但有大<span style="color: black;">机构</span>对其性能优化的加持,如社交软件Facebook推出了用于执行PHP代码的虚拟机HipHop VM,PHP的地位依然<span style="color: black;">无</span>被撼动。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在这两个黄金时代,PHP+MySQL的“黄金组合”造就了<span style="color: black;">非常多</span>经典的开源项目:WordPress、ecshop、Discuz! 等。</span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">2、PHP走下“神坛”,<span style="color: black;">优良</span>变桎梏</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">彻底结束掉 PHP “黄金时代”的是移动互联网的到来。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在万物成网的背景下,单体架构已<span style="color: black;">没法</span>满足<span style="color: black;">繁杂</span>业务群高并发、高可用的系统<span style="color: black;">需要</span>,于是微服务应运而生。业务的多样化、<span style="color: black;">繁杂</span>化<span style="color: black;">亦</span>触碰到了PHP的瓶颈。一方面PHP的性能<span style="color: black;">成为了</span>致命问题,另一方面其方便的机制因<span style="color: black;">没法</span>满足新的场景<span style="color: black;">需要</span>,反倒<span style="color: black;">成为了</span>桎梏。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">微服务的<span style="color: black;">显现</span>对PHP有<span style="color: black;">那些</span>影响呢?</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">一是微服务要轻量化,传统的PHP架构并不满足<span style="color: black;">需求</span>。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">二是服务要被多个业务端调用,运行要足够快;但PHP<span style="color: black;">做为</span>脚本语言,<span style="color: black;">因为</span>存在脚本解析消耗,运行速度确实赶不上 java、C++ 等静态语言。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">三是为了满足服务间的频繁通信,通信协议必须<span style="color: black;">有效</span>,<span style="color: black;">这般</span>一来<span style="color: black;">非常多</span><span style="color: black;">机构</span>倾向于<span style="color: black;">运用</span>RPC协议而非HTTP协议,但PHP架构并<span style="color: black;">不可</span>很好地应用RPC通信的<span style="color: black;">优良</span>。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">四是微服务要有较为成熟的生态和框架支持,但Swoole的微服务生态并不成熟。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">综合来看,大部分<span style="color: black;">机构</span>进行服务化时,会<span style="color: black;">选择</span>主流静态语言(java、C++ 以及后起之秀 golang 等)。PHP 的“C位”不保,<span style="color: black;">更加多</span>用来<span style="color: black;">研发</span>中间的业务聚合系统来调用这些服务。</span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">3、新版本的发布能让PHP重回巅峰吗?</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">为了适应当今的<span style="color: black;">研发</span><span style="color: black;">需要</span>,PHP团队<span style="color: black;">始终</span>在<span style="color: black;">奋斗</span>推动语言的现代化改进。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">近期</span>,PHP 8.3 的推出,添加了“类常量显式类型”、“只读属性深拷贝”,“以及对随机性功能的<span style="color: black;">弥补</span>”,这一系列的改进不仅让PHP更具竞争力,<span style="color: black;">亦</span>使得它更适应当今<span style="color: black;">繁杂</span>的应用场景,但<span style="color: black;">亦</span>许并<span style="color: black;">不可</span>带PHP重现高光时刻。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">重点</span><span style="color: black;">原由</span>来自编程语言生态系统中的重要角色——<span style="color: black;">研发</span>者群体。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">PHP的“简单、强大、实用”,<span style="color: black;">能够</span>让<span style="color: black;">研发</span>人员专心面对业务,但<span style="color: black;">这般</span>却<span style="color: black;">有害</span>于<span style="color: black;">研发</span>人员的成长。绝大部分的 PHPer 都是业务工程师,不<span style="color: black;">认识</span>设计模式、数据结构、算法、计算机原理,<span style="color: black;">没法</span>胜任<span style="color: black;">繁杂</span>的系统架构。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">有网友曾吐槽:PHP性能并非最大的问题,PHPer的水平才是合作过程中最让人“咬牙切齿”的槽点。大<span style="color: black;">都数</span>PHPer写了<span style="color: black;">数年</span>代码<span style="color: black;">亦</span>不会封装,分不清变量类型,<span style="color: black;">乃至</span>连自己的代码<span style="color: black;">亦</span>讲不明白。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">这<span style="color: black;">亦</span>许才是PHP 生态发展中最致命的<span style="color: black;">原因</span>。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">新版本的推出虽然弥补了语言<span style="color: black;">自己</span>的短板,却弥补不了生态中非语言部分的缺陷。既然 PHP 生态在<span style="color: black;">处理</span><span style="color: black;">繁杂</span>系统问题时不具备<span style="color: black;">优良</span>,<span style="color: black;">机构</span>就会<span style="color: black;">选取</span>其它更具<span style="color: black;">优良</span>的语言,自此便形成循环,PHP难回巅峰。</span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">4、PHP尚能饭否?</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">语言<span style="color: black;">无</span>最好的,无论是PHP,GO,Java,都有自己的定位,而 PHP恰好是PC Web时代最适合快速<span style="color: black;">研发</span>Web站点的。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">随着技术的高速发展,新的编程语言、框架如雨后春笋般冒出,可能<span style="color: black;">火速</span>就会改变现有格局,但这并不<span style="color: black;">寓意</span>着曾经的王者就会永远地黯然失色。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">首要</span>,PHP<span style="color: black;">日前</span>依然是<span style="color: black;">全世界</span>最流行的服务器端脚本语言之一。来自 W3Techs 的数据<span style="color: black;">表示</span>,WordPress 在43%的网站上运行,服务器端编程语言的网站中有 76.7% 都在<span style="color: black;">运用</span> PHP。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">其次,PHP<span style="color: black;">针对</span>处理Web请求和生成动态内容<span style="color: black;">拥有</span>天然的<span style="color: black;">优良</span>,其简单、灵活的特性,<span style="color: black;">尤其</span>适合业务、系统相对简单,无需服务化、对性能不<span style="color: black;">敏锐</span>、需要快速迭代的场景,<span style="color: black;">作为</span>许多初创<span style="color: black;">机构</span>和中小企业的首选<span style="color: black;">研发</span>语言;<span style="color: black;">另一</span>,大<span style="color: black;">机构</span>在发展初期,<span style="color: black;">海量</span>项目都采用PHP<span style="color: black;">做为</span>核心语言,为了适应业务的发展,会将单体项目中的某些核心功能拆解成服务,单体项目调用后端服务接口,这种<span style="color: black;">状况</span>下,PHP 项目就<span style="color: black;">成为了</span>粘合层。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">最后,PHP有庞大的社区支持。社区的强大<span style="color: black;">寓意</span>着有<span style="color: black;">海量</span>的开源工具、框架和库可供<span style="color: black;">选取</span>,<span style="color: black;">同期</span><span style="color: black;">亦</span><span style="color: black;">寓意</span>着问题的<span style="color: black;">处理</span><span style="color: black;">方法</span><span style="color: black;">更易</span><span style="color: black;">得到</span>。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">总之,PHP 在<span style="color: black;">将来</span>可预见的很长时期内不会没落,它会<span style="color: black;">做为</span>中小<span style="color: black;">机构</span>的快速原型语言和大<span style="color: black;">机构</span>的粘合层语言<span style="color: black;">长时间</span>存在,迎来属于它的“后黄金时代”。</span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">参考链接:</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">https://www.reddit.com/r/programming/comments/18hgduc/github_says_php_is_the_most_stagnating_language/</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">https://zhuanlan.zhihu.com/p/667402970</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">https://www.zhihu.com/question/442641007/answer/1726044472</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">https://baijiahao.baidu.com/s?id=1783339298344382156</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">源自</span>: 51CTO技术栈</span></p>




b1gc8v 发表于 2024-10-19 03:28:12

“沙发”(SF,第一个回帖的人)‌
页: [1]
查看完整版本: PHP老矣,尚能饭否?