2
Test mb_ereg_replace() function : usage variations
5
extension_loaded('mbstring') or die('skip');
6
function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not available in this build");
10
/* Prototype : proto string mb_ereg_replace(string pattern, string replacement, string string [, string option])
11
* Description: Replace regular expression for multibyte string
12
* Source code: ext/mbstring/php_mbregex.c
16
echo "*** Testing mb_ereg_replace() : usage variations ***\n";
18
// Initialise function arguments not being substituted (if any)
20
$string = 'string_val';
23
//get an unset variable
30
public function __toString() {
40
// get a resource variable
41
$fp = fopen(__FILE__, "r");
43
// unexpected values to be passed to $encoding argument
82
/*22*/ @$undefined_var,
91
// loop through each element of the array for pattern
94
foreach($inputs as $input) {
95
echo "\n-- Iteration $iterator --\n";
96
var_dump( mb_ereg_replace($pattern, $input, $string, $option) );
103
*** Testing mb_ereg_replace() : usage variations ***
106
string(10) "000000_000"
109
string(10) "111111_111"
112
string(46) "123451234512345123451234512345_123451234512345"
115
string(46) "-2345-2345-2345-2345-2345-2345_-2345-2345-2345"
118
string(37) "10.510.510.510.510.510.5_10.510.510.5"
121
string(46) "-10.5-10.5-10.5-10.5-10.5-10.5_-10.5-10.5-10.5"
124
string(109) "123456789000123456789000123456789000123456789000123456789000123456789000_123456789000123456789000123456789000"
127
string(118) "1.23456789E-91.23456789E-91.23456789E-91.23456789E-91.23456789E-91.23456789E-9_1.23456789E-91.23456789E-91.23456789E-9"
130
string(28) "0.50.50.50.50.50.5_0.50.50.5"
139
string(10) "111111_111"
145
string(10) "111111_111"
157
string(46) "UTF-8UTF-8UTF-8UTF-8UTF-8UTF-8_UTF-8UTF-8UTF-8"
160
string(46) "UTF-8UTF-8UTF-8UTF-8UTF-8UTF-8_UTF-8UTF-8UTF-8"
163
string(46) "UTF-8UTF-8UTF-8UTF-8UTF-8UTF-8_UTF-8UTF-8UTF-8"
166
string(46) "UTF-8UTF-8UTF-8UTF-8UTF-8UTF-8_UTF-8UTF-8UTF-8"
176
Warning: mb_ereg_replace() expects parameter 2 to be string, resource given in %s on line %d
b'\\ No newline at end of file'