You don’t need to do anything, ‘cause I already have all the hottest information about PHP for you!

Hello world, this is PHP 8.0.0 Beta 1, broadcast by Sun* News Radio. Here is a summary of the most interesting information about the PHP community recently!

Hello, World!

In this news, we will summarize the latest news about activities in the PHP community around the world recently: Information about projects, useful libraries, good posts to read, and then review some knowledge about PHP. 

PHP 8.0

It is now August and the first news is about PHP 8.0.

On August 6, PHP Core Team released PHP version 8.0.0 Beta 1 and put PHP 8.0 into the "Feature freeze" state, that is. This means no new functionality will be added to PHP 8.0 after the Beta 1 version. Instead, the community will focus on testing existing functionality and fixing bugs.

Following this release is Beta 2, Beta 3, RC (Release Candidate) 1-5, and PHP 8.0 is expected to be released by the end of November 2020.

Refer to the PHP 8.0 release schedule here

There are many new features in PHP 8.0, including:

  • PHP JIT, just in time, promises to bring significant performance improvements
  • Nullsafe operator, aside from coalescing operator (??), ternary operator (?:), the new operator (?->) will replace if/else command to make the code shorter
  • Named arguments, array_fill(start_index: 0, num: 100, value: 50), Named arguments, array_fill (start_index: 0, num: 100, value: 50), this is probably the function that brought many conflicts in the PHP community recently: D and it was finally accepted by the majority of the PHP members and was implemented on PHP version 8.0.
  • Attributes, also known as “annotation”. If you have ever used Symfony Framework or Doctrine ORM, with this feature, the code will be much easier to read and implement than to write code in the docblock comment. This is also a feature that is discussed a lot by the community when considering choosing between the syntax @@, # [], << >>...
  • Match expression, the shorter and more modern version of the switch
  • ext-json, will be compiled with PHP core and enabled by default, instead of installing the extension manually.

And there are many other new features, you can read this article for more details.

In addition to PHP 8.0, PHP 7.4.9 has also been released. Details of the releases here.

Since PHP 7 was born at the end of 2015, up to now, PHP 7.0 and PHP 7.1 versions have been end-of-life, upgrade to PHP 7.3, or PHP 7.4  if possible. For details of the PHP versions lifecycle, see here

Back in time, PHP is more than 25 years old. The first version was released on 1995-06-08 with the name "Personal Home Page Tools". So far the name has changed to "PHP: Hypertext Preprocessor". Let's take a look at some of the highlights with PHP Timeline

Tools

Let's check out some tools, libraries that have been released in new versions recently. 

  • Composer 2.0 Alpha 3: Prepare for Major release Composer 2.0 with the expected improvements in performance, download speeds, install packages. See more here.
  • beyondcode/expose: A tool that allows "expose localhost to internet", alternative open-source tool for ngrok, written in PHP with ReactPHP library
  • pestphp/pest:  Writes the unit test in the JavaScript style, based on PHPUnit and refer to the syntax from the facebook/jest package
  • FriendsOfPHP/pickle: Supports the installation of PECL extensions to be easier, based on Composer. And integrate with Composer from Composer version > = 2.1 as planned.
  • doctrine/migrations 3.0.0
  • phpsandbox.io :  Tests PHP online, and supports for installing packages using Composer, and sharing online. Similar to JSFiddle
  • PHP Security Checker Docker image: Docker image to run Symfony CLI security: check, check security for PHP applications

Videos

Here are some remarkable videos from the annual PHP events and conferences in 2020 

  • PHP Russia 2020 Online PHP Russia 2020 conference is held online with main focus on PHP 7 engine, PHP, SQL performance and Security.
  • Laracon EU Online 2020 Laravel Conference EU 2020 Online, as the name of the conference, includes topics related to Laravel such as CSRF and SameSite cookies, Exceptions Handler, View Components, OpenAPI, deploy with Ansible,...
  • Laracon Online 2020 in addition, it is expected that Laravel's official conference will be held on the 26th, the list of topics has been updated on the homepage stay tuned.

Remarkable posts

About PHP Type System
PHP is a dynamically typed language, the only thing you can do is type casting in code. However, in PHP 7, the declaration of data types for functions and methods was supported. This does not mean that PHP has become a statically typed language, it just helps the type hinting statically analyzed (analyze before running) and PHP still supports the dynamic type and mixed types. 
To better understand PHP Type System, let's review each part: 
- Types of data in PHP  
- Operations related to data types  
- Union types  
- Type juggling  
- Type modes (strict mode) 

Some tips to write clean code in Laravel [twitter.com/samuelstancl]
In this thread, the author gives some practices and code examples to write clean code in Laravel such as:  
- Use lookup table instead of elseif  
- Return early to Reduce nesting level  
- Don't declare redundant variables when you can return directly  
- Declare variables when it makes code easier to read  
- Use single-use trait  
- Use query scope  
- ... 
And many other practices, read and refer to these experiences.

Why do programmers need to have a testing mindset [viblo.asia/u/tangumiho]
From the post: Is this a question that surely many people are concerning? Dev: "I have to struggle with coding and now I also need to have a Testing mindset?" Tester: "It would be perfect if the dev has a little testing mindset" 
According to statistics and experience: The relationship between Dev and Tester does not seem to contain the word "peace" :D Each side thinks they are right and not wrong, always loses temper, and has a big ego.  
So, let's find out "Why programmers need to have a Testing mindset". 

2020 is already a new decade. I don't know who you are but learn how to test your code!

Review Laravel with Laravel Beauty series 
Maybe some of the code is outdated, but the common thought is the same, background knowledge is always important. The series of Laravel posts are worth reading. 
Tìm hiểu về Serverless LAMP stack với AWS [aws.amazon.com/blogs]
Series of Serverless posts for PHP developers from the AWS blog. This series will explain how to apply serverless to PHP, introduce support tools and frameworks, serverless architecture on AWS, and how to practice with Laravel or Symfony Framework. 
Other topics

So you want to be a wizard [twitter.com/@b0rk]
Do you want to get really good at your job? Me too. This zine is about how  learn new things about programming. It discusses:
 - how to ask awesome questions

- reading the source code

- debugging skills

- how to design software

- and more!

Hope it will be helpful for beginners. 

Review some knowledge about programming, computers

Learn Regular Expression and your life will be less suffer

Maybe you already know

Let's review some PHP knowledge. Show us your opinion in the comments section! 

1. Is the following code valid, why?

=> https://git.io/JJPPF

<?php

$options = [1, 2, 3];

foreach ($options as $option) try {

    if ($option == 2) {

        throw new \Exception('2 is missing!!');

    }

    echo $option . PHP_EOL;

} catch (\Exception $ex) {

    echo "Exception: ", $ex->getMessage(), "\n";

}

2. Is there a problem with the following code? What will the output be like?

=> https://git.io/JJPXT

<?php

$values = [1, 2, 42, 3];

foreach ($values as $value) {

    switch ($value) {

        case 1:

            echo 'Number one!' . PHP_EOL;

            break;

        case 42:

            echo 'Life is 42' . PHP_EOL;

            continue;

        default:

            echo 'Value is ' . $value . PHP_EOL;

            break;

    }

}

#PHP