PHP Classes

PHP Backwards Compatibility Library: Functions of newer PHP versions for older versions

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (33)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog (2)    
Last Updated Ratings Unique User Downloads Download Rankings
2024-02-21 (4 hours ago) RSS 2.0 feedNot yet rated by the usersTotal: 75 This week: 9All time: 10,132 This week: 7Up
Version License PHP version Categories
phpbcl 1.0.6Freeware5.6PHP 5, Language
Description 

Author

This package provides functions of newer PHP versions for older versions.

It provides scripts that implement functions only available in newer PHP versions as functions built-in in the PHP core engine. The parts work in older PHP versions.

A main script checks the current PHP version and loads that implement the functions of newer PHP versions.

Innovation Award
PHP Programming Innovation award nominee
June 2023
Number 2
With every new PHP version, changes are made to the PHP language that may introduce incompatibilities between versions.

If your PHP applications rely on parts of the language that were changed, you may need to change your code to keep it working in the new PHP version that runs on the machine your PHP application is running.

Suppose your PHP application relies on PHP function or other parts of the language that changed in a backward incompatibility way. In that case, you may need to change your PHP application code to adapt to the PHP version changes.

This package provides a library of scripts with PHP functions that emulate the functions introduced in newer PHP versions.

Using this library, you can adapt your PHP application code to make it work in a newer PHP version without having to upgrade the PHP version that you use in the environment your PHP application is running.

This way, you can change your PHP application code to prepare to make it work in newer PHP versions making a smooth transition between PHP versions.

Manuel Lemos
Picture of ASCOOS CMS
  Performance   Level  
Name: ASCOOS CMS <contact>
Classes: 6 packages by
Country: Greece Greece
Age: ???
All time rank: 421725 in Greece Greece
Week rank: 5 Up1 in Greece Greece Up
Innovation award
Innovation award
Nominee: 3x

Example

<?php
/**
 * __ _ ___ ___ ___ ___ ___ ____ _ __ ___ ___
 * / _` |/ / / __/ _ \ / _ \ / / / __/| '_ ` _ \ / /
 * | (_| |\ \| (_| (_) | (_) |\ \ | (__ | | | | | |\ \
 * \__,_|/__/ \___\___/ \___/ /__/ \___\|_| |_| |_|/__/
 *
 *
 *************************************************************************************
 * @ASCOOS-NAME : ASCOOS CMS 24' *
 * @ASCOOS-VERSION : 24.0.0 *
 * @ASCOOS-CATEGORY : Kernel (Frontend and Administration Side) *
 * @ASCOOS-CREATOR : Drogidis Christos *
 * @ASCOOS-SITE : www.ascoos.com *
 * @ASCOOS-LICENSE : [Commercial] http://docs.ascoos.com/lics/ascoos/AGL-F.html *
 * @ASCOOS-COPYRIGHT : Copyright (c) 2007 - 2023, AlexSoft Software. *
 *************************************************************************************
 *
 * @package : ASCOOS CMS - phpBCL
 * @subpackage : Example mb_trim, mb_ltrim, mb_rtrim Function
 * @source : /phpBCL/test/84__mb_trim.php
 * @version : **** - $release: 1.0 - $revision: 6 - $build: ****
 * @created : 2024-02-20 03:00:00 UTC+3
 * @updated : 2024-02-21 18:00:00 UTC+3
 * @author : Drogidis Christos
 * @authorSite : www.alexsoft.gr
 *
 * @since 8.0.0
 */

define('ALEXSOFT_RUN_CMS', true);

$cms_path = str_replace('/phpBCL/test', '', str_replace('\\', '/', __DIR__));
 
require_once(
$cms_path."/phpBCL/src/coreCompatibilities.php");

// Example usage:
//$characters = " \f\n\r\t\v\x00\u{00A0}\u{1680}\u{2000}\u{2001}\u{2002}\u{2003}\u{2004}\u{2005}\u{2006}\u{2007}\u{2008}\u{2009}\u{200A}\u{2028}\u{2029}\u{202F}\u{205F}\u{3000}\u{0085}\u{180E}";

// TEST STRING WITH MULTIBYTE CHARS
$str = "\n \f \v \t \u{2006} Good morning world! \t\u{2000}\u{2001}\u{2002}\f";

// EXECUTE mb_ltrim, mb_rtrim, mb_trim
//$trimmedLeft = mb_ltrim($str, $characters, 'UTF-8');
//$trimmedRight = mb_rtrim($str, $characters, 'UTF-8');
//$trimmedBoth = mb_trim($str, $characters, 'UTF-8' );
$trimmedLeft = mb_ltrim($str);
$trimmedRight = mb_rtrim($str);
$trimmedBoth = mb_trim($str);
?>
<html>
<head>
    <style>
        h1 {font-size: 2em; font-weight: bold; width: 100% !important; }
        h2 {font-size: 1.5em; font-weight: bold; padding: 5px; color: white; background-color: black; width: 100% !important; margin: 4px 0;}
    </style>
</head>
<body>
<?php
echo '<h1>PHP VERSION: '.phpversion().'</h1>';
echo
'<h2>TEST PHP 8.4 [ <b>mb_ltrim & mb_rtrim & mb_trim</b> ] </h2>';
echo
'<p>ORIGINAL STRING : ['.$str.']</p>';
echo
'<p><br></p>';

echo
'<p>mb_ltrim [Trimmed Left]....: ['.$trimmedLeft.']</p>';
echo
'<p>mb_rtrim [Trimmed Right]...: ['.$trimmedRight.']</p>';
echo
'<p>mb_trim [Trimmed Both]....: ['.$trimmedBoth.']</p>';
?>
</body>
</html>


Details

Changelog

1.0.6 [2024-02-21]

  • FIXED EXAMPLES
  • ADDED SCREENSHOTS

*

1.0.5 [2024-02-20]

PHP < 8.4.0

  • ADDED FILE: `/src/phpBCL.php`
  • Added phpBCL Function `validate_encoding`
  • Added Function `mb_ltrim`
  • Added Function `mb_rtrim`
  • Added Function `mb_trim`
  • ADDED EXAMPLE: `/test/84__mb_trim.php`
  • Updated Function `mb_ucfirst`
  • Updated Function `mb_lcfirst`
  • Updated Example `/test/84__mb_ucfirst.php`

*

1.0.4 [2024-02-17]

PHP < 8.4.0

  • Added file `src/compat/compat_php84x.php`
  • Added Function `mb_ucfirst`
  • Added Function `mb_lcfirst`
  • ADDED EXAMPLE: `/test/84__mb_ucfirst.php`

*

1.0.3 [2023-07-12]

PHP < 8.2.0

  • Added Function `mysqli_execute_query`

*

1.0.2 [2023-07-07]

  • ADDED EXAMPLES: In folder /phpBCL/test/
  • Fixed : Fixed paths for call phpBCL library.

PHP < 4.3.0

  • Added Constants: `MB_CASE_UPPER`, `MB_CASE_LOWER`, `MB_CASE_TITLE`
  • Added Function: `mb_convert_case`

PHP < 5.5.0

  • Added Functions: `array_column`, `boolval`, `json_last_error_msg`

PHP < 7.3.0

  • Added Constants: `MB_CASE_FOLD`, `MB_CASE_UPPER_SIMPLE`, `MB_CASE_LOWER_SIMPLE`, `MB_CASE_TITLE_SIMPLE`, `MB_CASE_FOLD_SIMPLE`. Used by ASCOOS LIBRARY FUNCTION `alf_mb_convert_case` (compat_similar.php)
  • Updated Functions: `array_key_first`, `array_key_last`
ASCOOS LIBRARY FUNCTION:
  • Added `alf_mb_convert_case` For full compatible similar mb_convert_case.

PHP < 7.4.0

  • Added Function: `mb_str_split`

PHP < 8.0.0

  • Updated Functions: `str_contains`, `str_ends_with`, `str_starts_with`
  • Updated Classes : `Stringable`, `PhpToken`

PHP < 8.1.0

  • Updated Function: `array_is_list`

PHP < 8.3.0

  • Added Function: `mb_str_pad`

*

1.0.1 [2023-06-27]

  • Added file compat_similar.php (for similar functions)

PHP < 7.1.0

  • Added Function: `is_iterable`

PHP < 7.3.0

  • Added Functions: `array_key_first`, `array_key_last`, `is_countable`

PHP < 8.0.0

  • Added Class `ValueError` (For php < 8.0.0)

*

1.0.0

  • Creating Compatibilities

Screenshots  
  • 81__array_is_list
  • 84__mb_ucfirst.png
  • mb_trim
  • mb_trim.jpeg
  Files folder image Files  
File Role Description
Files folder imagedocs (1 file)
Files folder imagescreenshots (5 files)
Files folder imagesrc (2 files, 1 directory)
Files folder imagetest (9 files)
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  docs  
File Role Description
  Accessible without login Plain text file why-you-need-phpBCL.md Data Auxiliary data

  Files folder image Files  /  screenshots  
File Role Description
  Accessible without login Image file 81__array_is_list.png Icon Icon image
  Accessible without login Image file 84__mb_trim.png Icon Icon image
  Accessible without login Image file 84__mb_ucfirst_640.png Icon Icon image
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login Image file mb_trim.jpeg Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imagecompat (13 files)
  Accessible without login Plain text file coreCompatibilities.php Aux. Auxiliary script
  Plain text file phpBCL.php Class Class source

  Files folder image Files  /  src  /  compat  
File Role Description
  Accessible without login Plain text file compat_deprecated.php Aux. Auxiliary script
  Plain text file compat_php43x.php Class Class source
  Plain text file compat_php55x.php Class Class source
  Accessible without login Plain text file compat_php71x.php Aux. Auxiliary script
  Accessible without login Plain text file compat_php73x.php Aux. Auxiliary script
  Accessible without login Plain text file compat_php74x.php Aux. Auxiliary script
  Plain text file compat_php80x.php Class Class source
  Accessible without login Plain text file compat_php81x.php Aux. Auxiliary script
  Plain text file compat_php82x.php Class Added in 1.0.3
  Accessible without login Plain text file compat_php83x.php Example Example script
  Accessible without login Plain text file compat_php84x.php Aux. Auxiliary script
  Accessible without login Plain text file compat_similar.php Aux. Auxiliary script
  Accessible without login HTML file index.html Doc. Documentation

  Files folder image Files  /  test  
File Role Description
  Accessible without login Plain text file 55__array_column.php Example Example script
  Accessible without login Plain text file 73__mb_convert_case.php Example Example script
  Accessible without login Plain text file 74_mb_str_split.php Example Example script
  Accessible without login Plain text file 80__class_Stringable.php Example Example script
  Accessible without login Plain text file 81__array_is_list.php Example Example script
  Accessible without login Plain text file 83__mb_str_pad.php Example Example script
  Accessible without login Plain text file 84__mb_trim.php Example Example script
  Accessible without login Plain text file 84__mb_ucfirst.php Example Unit test script
  Accessible without login Plain text file example.php Example Example script

 Version Control Unique User Downloads Download Rankings  
 89%
Total:75
This week:9
All time:10,132
This week:7Up