In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
What are the new features of all versions of php7? many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.
New features of each version of php7 summarize the new features of PHP7.1 1. Nullable (Nullable) type
The type of the parameter and the return value can now be allowed to be empty by putting a question mark before the type. When this feature is enabled, the result returned by the passed parameter or function is either a given type or null
# php5function ($a = null) {if ($a===null) {return null;} return $a;} # php7+function fun ():? string {return null;} function fun1 (? $a) {var_dump ($a);} fun1 (null); / / nullfun1 ('1'); / / 12. Void type
The method that returns the value declared as void can either omit the return statement altogether. NULL is not a legal return value for void.
Function fun (): void {echo "hello world";} 3. Class constant visibility class Something {const PUBLIC_CONST_A = 1; public const PUBLIC_CONST_B = 2; protected const PROTECTED_CONST = 3; private const PRIVATE_CONST = 4;} 4. Iterable pseudo-class
This can be used in parameters or return value types, which represent objects that accept arrays or implement the Traversable interface.
Function iterator (iterable $iter) {foreach ($iter as $val) {/ /} 5. Multiple exception capture processing
A catch statement block can now capture multiple exceptions through the pipe character (_ | _). This is useful when you need to handle different exceptions from different classes at the same time.
Try {/ / some code} catch (FirstException | SecondException $e) {/ / handle first and second exceptions} 6. List supports key name $data = [["id" = > 1, "name" = > 'Tom'], ["id" = > 2, "name" = >' Fred'],]; / / list () stylelist ("id" = > $id1, "name" = > $name1) = $data [0]; var_dump ($id1); / / 17. The string supports negative $a = "hello"; $a [- 2]; / / l8. Convert callback to closure
Closure has added a static method to quickly convert callable into a Closure object.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.