Skip to main content

PHP 8 New Concepts

 PHP 8 New Concepts

PHP 8 is a major update to the PHP programming language, which was released on November 26, 2020. It introduces several new features and improvements over the previous version, PHP 7. Here are some of the key new concepts introduced in PHP 8:

  1. Union Types: PHP 8 introduces union types, which allow for defining a variable or parameter that can accept multiple types. This allows for more flexibility in defining function signatures and can make it easier to write code that can handle different types of input.

  2. Named Arguments: PHP 8 introduces named arguments, which allow for passing arguments to a function by name, rather than position. This can make it easier to understand the purpose of each argument, and can make it easier to change the order of arguments.

  3. Attributes: PHP 8 introduces attributes, which are metadata that can be associated with classes, methods, properties, and other language constructs. They can be used to provide additional information about a construct, such as its purpose or how it should be handled by a specific tool or framework.

  4. Match Expressions: PHP 8 introduces match expressions, which are similar to switch statements but with improved type safety and error handling. They allow for easy pattern matching and can help make code more readable and maintainable.

  5. Null Coalescing Assignment Operator: PHP 8 introduces the null coalescing assignment operator (??=), which allows for assigning a value to a variable only if it is currently null. This can help reduce the amount of code needed to check for null values before assigning a value.

  6. JIT Compiler: PHP 8 introduces a Just-In-Time (JIT) compiler, which can improve the performance of PHP applications by dynamically compiling certain parts of the code at runtime. This can help reduce the overhead of interpreting PHP code and can lead to significant performance gains.

  7. Improved Type Safety: PHP 8 introduces several improvements to type safety, including stricter type checking, improved error handling, and more consistent type coercion. This can help reduce the number of bugs in PHP code and make it easier to catch and fix errors.

  8. Other improvements: PHP 8 also includes other improvements such as improved support for Unicode, improved support for 64-bit integers, and improved support for exceptions.

These are just some of the new concepts introduced in PHP 8. It is worth to check the official documentation to have a deeper understanding of the new features and how to use them effectively in your code

Comments

Popular posts from this blog

Run and compile sass scss file to css using node

  Today we learn how to use scss and generate css using node  or Run and compile sass scss file to css using node   So please follow simple  steps :-   Today we will create a project that can read scss file and generates css with it  Note: Make sure you have installed node in your system. If you want to help to install node js based on your system then check our other tutorial or check node js official website. Now create a blank folder and open  terminal(linux) or cmd(windows) and navigate to your current project folder by using cd command Now run below command npm init after enter it will ask you some package info that you can fill according to you or just keep enter until it finished. The above command will generate package.json file Now  we will install npm module that will convert our scss to css Run below command: npm install node-sass So we have installed node-sass package . Now open package.json file in your...

How to retrieve Facebook Likes, share , comment Counts

function facebook_count($url){     // Query in FQL     $fql  = "SELECT share_count, like_count, comment_count ";     $fql .= " FROM link_stat WHERE url = '$url'";     $fqlURL = "https://api.facebook.com/method/fql.query?format=json&query=" . urlencode($fql);     // Facebook Response is in JSON     $response = file_get_contents($fqlURL);     return json_decode($response); } $fb = facebook_count('https://www.facebook.com/BahutHoGyiPadhai'); // facebook share count echo $fb[0]->share_count;  echo "like"; // facebook like count echo $fb[0]->like_count ; echo "comment"; // facebook comment count echo $fb[0]->comment_count;  ?>

Solution-windows 'expo' is not recognized as an internal or external command

Solution for expo is not recognized as an internal or external command,operable program or batch file in Windows 10 Sometimes expo will not work globally mostly in windows 10, If you are facing same issue then follow the below Steps 1) Click on windows button and search for  " Environment variables"  and click on "Edit the system environment variables" 2) Now you will see a popup like below screen. Then you need to click on Environment Variables. (Please see highlight part in below image)     3)Then click on new button that i have highlighted in below image 4. Then a popup will open and you need to fill details like below mentioned Variable Name :Path Variable Value: %USERPROFILE%\AppData\Roaming\npm Here we are creating a new path variable and passing location of npm.   Now Click on OK and close all the terminal windows and open new CMD or terminal and type Expo . Great now you can access expo from any...