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