Martin  Dreech

Martin Dreech

1594821436

Match Expression is Coming to PHP 8

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

What is GEEK

Buddha Community

Match Expression is Coming to PHP 8
Martin  Dreech

Martin Dreech

1594821436

Match Expression is Coming to PHP 8

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

Hire PHP Developer

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

Hunter  Krajcik

Hunter Krajcik

1617466260

How to Install PHP 8 on Ubuntu 20.04

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.

Step 1 – Installing PHP 8 on Ubuntu

Use the following commands to add PPA and install PHP 8.0 on Ubuntu 20.04 system.

  1. Enable PPA – Use the following command
sudo add-apt-repository ppa:ondrej/php 
  1. Update cache – After enabling apt repository, update cache on your system.
sudo apt update 
  1. Installing PHP – Next, install the PHP 8.0 on Ubuntu system.
sudo apt install php8.0 
  1. Press ‘Y’ for any confirmation asked by the installer.

Once completed above commands, you have successfully installed PHP 8.0 on Ubuntu system.

#php #php 8 #php 8.0

Hire PHP Developer - Best PHP Web Frameworks for Web Development

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

  • Laravel Developer
  • Codeigniter Developer
  • Yii Developer
  • Zend Developer
  • Cake PHP Developer
  • Core PHP Developer

Not sure which framework to use for your PHP web application?

Contact us

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

Mike  Kozey

Mike Kozey

1617431460

How Much Does it Cost to Hire a Developer for Your PHP Project

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.

** Here are the essential benefits of PHP:**

  • Versatility: PHP provides the flexibility to build web solutions of any type, right from simple brochureware sites to sophisticated websites with enterprise-level functions. It functions on all existing platforms as well as databases such as Oracle, Postgres.
  • Open Source: PHP is free to download, giving developers an option to work with it, so it’s always easy to find professionals and scale your project. PHP web development is a cost-effective option in terms of prices.

#php #hire php developer #php #php 8