1--TEST--
2Test mb_ereg_match() function : basic functionality
3--EXTENSIONS--
4mbstring
5--SKIPIF--
6<?php
7function_exists('mb_ereg_match') or die("skip mb_ereg_match() is not available in this build");
8?>
9--FILE--
10<?php
11/*
12 * Test basic functionality of mb_ereg_match
13 */
14
15mb_internal_encoding('UTF-8');
16mb_regex_encoding('UTF-8');
17
18echo "*** Testing mb_ereg_match() : basic functionality ***\n";
19$string_ascii = 'abc def, 0123456789';
20$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
21
22//will return true as pattern matches from start of string
23echo "\n-- ASCII string 1 --\n";
24var_dump(mb_ereg_match('.*def', $string_ascii));
25
26//will return false as pattern would match half way through string
27echo "\n-- ASCII string 2 --\n";
28var_dump(mb_ereg_match('def', $string_ascii));
29
30echo "\n-- Multibyte string 1 --\n";
31$regex1 = base64_decode('5pel5pys6KqeKC4qKT9bMS05XSs=');
32var_dump(mb_ereg_match($regex1, $string_mb, 'i'));
33
34echo "\n-- Multibyte string 2 --\n";
35$regex2 = base64_decode('5LiW55WM');
36var_dump(mb_ereg_match($regex2, $string_mb));
37
38echo "Done";
39?>
40--EXPECT--
41*** Testing mb_ereg_match() : basic functionality ***
42
43-- ASCII string 1 --
44bool(true)
45
46-- ASCII string 2 --
47bool(false)
48
49-- Multibyte string 1 --
50bool(true)
51
52-- Multibyte string 2 --
53bool(false)
54Done
55