1594821436
The Match Expression v2 RFC has passed and targets the stable release of PHP v8.0! The RFC still leaves room for future improvement (noted in the RFC), but for now we get single-line expressions that provide a clean, terse syntax for matching expressions.
Since match() {}
is an expression
, you can capture the value via assignment or return
without having to assign to a local variable:
// Before
switch ($this->lexer->lookahead['type']) {
case Lexer::T_SELECT:
$statement = $this->SelectStatement();
break;
case Lexer::T_UPDATE:
$statement = $this->UpdateStatement();
break;
case Lexer::T_DELETE:
$statement = $this->DeleteStatement();
break;
default:
$this->syntaxError('SELECT, UPDATE or DELETE');
break;
}
// After
$statement = match ($this->lexer->lookahead['type']) {
Lexer::T_SELECT => $this->SelectStatement(),
Lexer::T_UPDATE => $this->UpdateStatement(),
Lexer::T_DELETE => $this->DeleteStatement(),
default => $this->syntaxError('SELECT, UPDATE or DELETE'),
};
As you can see above, the match
expression means no accidental fall through when you forget a break
as part of a switch
case. A missing condition (and no default provided) results in a thrown UnhandledMatchError
exception with the match expression.
#php #php 8
1594821436
The Match Expression v2 RFC has passed and targets the stable release of PHP v8.0! The RFC still leaves room for future improvement (noted in the RFC), but for now we get single-line expressions that provide a clean, terse syntax for matching expressions.
Since match() {}
is an expression
, you can capture the value via assignment or return
without having to assign to a local variable:
// Before
switch ($this->lexer->lookahead['type']) {
case Lexer::T_SELECT:
$statement = $this->SelectStatement();
break;
case Lexer::T_UPDATE:
$statement = $this->UpdateStatement();
break;
case Lexer::T_DELETE:
$statement = $this->DeleteStatement();
break;
default:
$this->syntaxError('SELECT, UPDATE or DELETE');
break;
}
// After
$statement = match ($this->lexer->lookahead['type']) {
Lexer::T_SELECT => $this->SelectStatement(),
Lexer::T_UPDATE => $this->UpdateStatement(),
Lexer::T_DELETE => $this->DeleteStatement(),
default => $this->syntaxError('SELECT, UPDATE or DELETE'),
};
As you can see above, the match
expression means no accidental fall through when you forget a break
as part of a switch
case. A missing condition (and no default provided) results in a thrown UnhandledMatchError
exception with the match expression.
#php #php 8
1597820991
Looking to develop a PHP based website from scratch or revamp your existing website?
HourlyDeveloper.io has always been an industry leader for companies and business owners looking to hire PHP web developer. By choosing to Hire PHP Developer from our company, you can always expect the best results. Our PHP services and solutions are always flexible which means that no matter the nature of your project, you can always count on us for getting the best PHP expertise.
Consult with our experts: https://bit.ly/3aEGxPy
#hire php developer #php developer #php development company #php development services #php development #php
1617466260
PHP is an acronym of “Hypertext Preprocessor” is a scripting language widely used for developing web applications. It is the server side scripting language that is embedded in HTML. Which is used to manage dynamic content, databases, session tracking, even build entire e-commerce websites.
PHP 8.0 is the latest stable version available for production use. The debian packages for PHP 8 is available under ppa:ondrej/php PPA for Ubuntu systems.
This tutorial will help you to install PHP 8.0 on Ubuntu 20.04 LTS Focal system.
Use the following commands to add PPA and install PHP 8.0 on Ubuntu 20.04 system.
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.0
Once completed above commands, you have successfully installed PHP 8.0 on Ubuntu system.
#php #php 8 #php 8.0
1617276472
A framework that can drastically cut down the requirement to write original code to develop the web apps as per your requirement is PHP Framework. PHP frameworks offer code libraries for commonly used functions to reduce the development time.
Want to use PHP Web Frameworks for your web applications?
WebClues Infotech offers a service to hire dedicated PHP developers for all of the below-mentioned frameworks
Not sure which framework to use for your PHP web application?
Schedule Interview with PHP Developer https://bit.ly/3dsTWf0
Email: sales@webcluesinfotech.com
#hire php developer #hire php web developers #hire php developer in 2021 #hire php developers & dedicated php programmers #hire php developers india #hire and outsource freelance php developers
1617431460
Created by Rasmus Lerdorf back in 1994, PHP is a general-purpose scripting language, especially for web development. PHP initially stood for Personal Home Page, however now it stands for the recursive initialism PHP: Hypertext Preprocessor.
PHP is a server-side scripting language extensively used to create highly dynamic and interactive websites and numerous advantages.
PHP is convenient, easy to learn, with libraries, documentation, tutorials, and what strikes the most is the huge community. PHP programming language can be used to develop any type of website imaginable, irrespective of complexity, and magnitude.
#php #hire php developer #php #php 8