]> projects.mako.cc - scuttle/blob - includes/utf8/docs/examples/1.php
added jQuery UI autocomplete to the tags field when editing a bookmark
[scuttle] / includes / utf8 / docs / examples / 1.php
1 <?php
2 header('content-type: text/html; charset=utf-8');
3
4 # Require the main "loader" script...
5 require_once '../../utf8.php';
6
7 # UTF8 constant can now be used for directory
8 # Follow functions automatically available;
9 # utf8_strlen, utf8_strpos, utf8_strrpos, utf8_substr,
10 # utf8_strtolower, utf8_strtoupper
11
12 # A UTF-8 string...
13 $str = 'Iñtërnâtiônàlizætiøn';
14
15 print "String is: $str<br>\n";
16
17 # Check it's a well formed UTF-8 string
18 require_once UTF8 . '/utils/validation.php';
19 if ( utf8_is_valid($str) ) {
20     print "It's well formed UTF-8<br>\n";
21 } else {
22     print "It's badly formed UTF-8 - this shouldn't happen<br>\n";
23 }
24
25 print "Num chars: ".utf8_strlen($str)."<br>\n";
26
27 print "Uppercase: ".utf8_strtoupper($str)."<br>\n";
28
29 # Load an additional function;
30 require_once UTF8 . '/strrev.php';
31
32 print "Reversed: ".utf8_strrev($str)."<br>\n";
33 ?>

Benjamin Mako Hill || Want to submit a patch?