Skip to content

rolandinsh/ereg-extension-wrapper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

PHP ereg extension wrapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%