-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht_utf8.php
61 lines (42 loc) · 1.51 KB
/
t_utf8.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
header('Content-type: text/html; charset=UTF-8');
include_once "../include.inc.php";
mb_internal_encoding("UTF-8");
include_once "utilsx.inc.php";
include_once "classes/syllable_splitter2utf.class.php";
$param = getParamOrDefault("w", "comer");
$sc = new StringCaret($param);
// test output
echo "<h3>$param</h3>";
for($i= 0; $i < strlen($param) ; $i++)
{
echo "[".$param[$i]."] ";
}
echo "<br>\n";
$mlen = mb_strlen($param);
for( $i = 0 ; $i < $mlen; $i++)
{
echo "[". mb_substr($param, $i, 1)."]";
}
echo "<p>";
$needle = "ру";
$res = mb_strstr($param, $needle);
if ( $res === false)
{
echo "cannot find substring [$needle] in [$param]";
}
else
{
echo "found substring [$needle] in [$param]";
}
// string caret iteration
echo "<p>Now iteration from string caret: ";
for ( ; !$sc->isOutsideWord(); $sc->movePosition())
{
echo "[". $sc->curChar() ."]" ;
}
?>
<form method="GET">
<input type="text" name="w" value="<? echo $param; ?>">
<input type="submit" value="Check word">
</form>