Skip to content
PHP ereg extension wrapper
Branch: master
Clone or download
Latest commit 37e4d18 Feb 17, 2018

README.md

Wrapper for PHP ereg extension

GitHub license

The ereg-wrapper api support ereg extension api, and was designed to work best as with ereg extension. If you have PHP7 environment and must need removed ereg extension api, this is good choise.

This APIs have been implemented using PHP PCRE (Perl compatible regular expression, preg_*) internally.

License

BSD 2-clause

Requirements

  1. PHP 7.0.0 and after

SYNOPSIS

ereg : http://php.net/manual/en/function.ereg.php

int ereg ( string $pattern , string $string [, array &$regs ] )

eregi : http://php.net/manual/en/function.eregi.php

int eregi ( string $pattern , string $string [, array &$regs ] )

ereg_replace : http://php.net/manual/en/function.ereg-replace.php

string ereg_replace ( string $pattern , string $replacement , string $string )

eregi_replace : http://php.net/manual/en/function.eregi-replace.php

string eregi_replace ( string $pattern , string $replacement , string $string )

split : http://php.net/manual/en/function.split.php

array split ( string $pattern , string $string [, int $limit = -1 ] )

spliti : http://php.net/manual/en/function.spliti.php

array spliti ( string $pattern , string $string [, int $limit = -1 ] )

sql_regcase : http://php.net/manual/en/function.sql-regcase.php

string sql_regcase ( string $string )

Example

<?php
# even if loaded ereg extension, well done.
require_once 'ereg-wrapper.php';

if ( ! ereg ('a', 'aaa') )
    echo 'not ';
echo "matched\n";

if ( ! eregi ('A', 'aaa') )
    echo 'not ';
echo "matched\n";
?>

Composer

first, make composer.json as follow:

{
    "require": {
        "joungkyun/ereg-extension-wrapper": "1.0.*"
    }
}

and, install ereg-extension-wrapper

[user@host project]$ php composer.phpt install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing joungkyun/ereg-extension-wrapper (1.0.1): Downloading (100%)
Writing lock file
Generating autoload files
[user@host project]$

and, write code as follow:

<?php
require_once 'vendor/autoload.php';

echo 'eregi_replace is supported ';
if ( function_exists('eregi_replace') )
    echo 'YES';
else
    echo 'NO';

echo "\n";
?>

Credits

JoungKyun.Kim

You can’t perform that action at this time.