Article 71NR4 PHP 8.5 Brings Long-Awaited Pipe Operator, Adds New URI Tools

PHP 8.5 Brings Long-Awaited Pipe Operator, Adds New URI Tools

by
EditorDavid
from Slashdot on (#71NR4)
"PHP 8.5 landed on Thursday with a long-awaited pipe operator and a new standards-compliant URI parser," reports the Register, "marking one of the scripting language's more substantial updates... "The pipe operator allows function calls to be chained together, which avoids theextraneous variables and nested statements that might otherwise beinvolved. Pipes tend to make code more readable than other ways toimplement serial operations. Anyone familiar with the Unix/Linuxcommand line or programming languages like R,F#,Clojure, orElixirmay have used the pipe operator. In JavaScript, aka ECMAScript, apipe operator has been proposed, though there are alternativeslike method chaining. Another significant addition is the URIextension, which allows developers to parse and modify URIs andURLs based on both the RFC 3986 and the WHATWG URL standards. Parsingwith URIs and URLs a" reading them and breaking them down into theirdifferent parts a" is a rather common task for web-orientedapplications. Yet prior versions of PHP didn't include astandards-compliant parser in the standard library. As notedby software developer Tim DA1/4sterhus, the parse_url()function that dates back to PHP 4 doesn't follow any standard andcomes with a warning that it should not be used with untrusted ormalformed URLs. Other noteworthy additions to the language include: CloneWith, for updating properties more efficiently; the #[\NoDiscard] attribute, for warning when a return value goes unused; theability to use static closures and first-class callables in constant expressions; and persistent cURL handles that can be shared across multiple PHP requests.

twitter_icon_large.pngfacebook_icon_large.png

Read more of this story at Slashdot.

External Content
Source RSS or Atom Feed
Feed Location https://rss.slashdot.org/Slashdot/slashdotMain
Feed Title Slashdot
Feed Link https://slashdot.org/
Feed Copyright Copyright Slashdot Media. All Rights Reserved.
Reply 0 comments