PHP Classes

File: match_expression.php

Recommend this page to a friend!
  Classes of Allan Kibet  >  Learn New PHP 8 Features  >  match_expression.php  >  Download  
File: match_expression.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Learn New PHP 8 Features
Examples of how to use PHP 8 new features
Author: By
Last change:
Date: 6 months ago
Size: 244 bytes
 

Contents

Class file image Download
<?php


$status_code
= 800;

$message = match($status_code) {
   
200 => "Success",
   
300 => "Redirect",
   
403 => "Not found",
   
500 => "Server Error",
   
700, 800 => null,
    default =>
"Unknown"
};


var_dump($status_code, $message);

For more information send a message to info at phpclasses dot org.