source: src/router/php7/ext/mbstring/tests/mb_ereg_search_setpos.phpt @ 31874

Last change on this file since 31874 was 31874, checked in by brainslayer, 3 months ago

update php

File size: 1.2 KB
Line 
1--TEST--
2mb_ereg_search_setpos() function
3--SKIPIF--
4<?php
5if (!extension_loaded('mbstring')) die('skip mbstring not enabled');
6?>
7--FILE--
8<?php
9mb_regex_encoding('iso-8859-1');
10$test_str = 'Iñtërnâtiônàlizætiøn'; // Length = 20
11
12var_dump(mb_ereg_search_setpos(50)); // OK
13var_dump(mb_ereg_search_setpos(-1)); // Error
14
15mb_ereg_search_init($test_str);
16
17$positions = array( 5, 20, 21, 25, 0, -5, -20, -30);
18foreach($positions as $pos) {
19        echo("\n* Position: $pos :\n");
20        var_dump(mb_ereg_search_setpos($pos));
21        var_dump(mb_ereg_search_getpos());
22}
23?>
24==DONE==
25--EXPECTF--
26bool(true)
27
28Warning: mb_ereg_search_setpos(): Position is out of range in %s on line %d
29bool(false)
30
31* Position: 5 :
32bool(true)
33int(5)
34
35* Position: 20 :
36bool(true)
37int(20)
38
39* Position: 21 :
40
41Warning: mb_ereg_search_setpos(): Position is out of range in %s on line %d
42bool(false)
43int(0)
44
45* Position: 25 :
46
47Warning: mb_ereg_search_setpos(): Position is out of range in %s on line %d
48bool(false)
49int(0)
50
51* Position: 0 :
52bool(true)
53int(0)
54
55* Position: -5 :
56bool(true)
57int(15)
58
59* Position: -20 :
60bool(true)
61int(0)
62
63* Position: -30 :
64
65Warning: mb_ereg_search_setpos(): Position is out of range in %s on line %d
66bool(false)
67int(0)
68==DONE==
69
70
Note: See TracBrowser for help on using the repository browser.