Refactored ConfigFile class so that it is no longer a singleton
[phpmyadmin.git] / libraries / StringNative.class.php
blobb333610a90c2c72e3cef62c9f78f35463821dcaf
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Implements PMA_StringByte interface using native PHP functions.
6 * @package PhpMyAdmin-String
7 * @subpackage Native
8 */
9 if (! defined('PHPMYADMIN')) {
10 exit;
13 require_once 'libraries/StringByte.int.php';
15 /**
16 * Implements PMA_StringByte interface using native PHP functions.
18 * @package PhpMyAdmin-String
19 * @subpackage Native
21 class PMA_StringNative implements PMA_StringByte
23 /**
24 * Returns length of string depending on current charset.
26 * @param string $string string to count
28 * @return int string length
30 public function strlen($string)
32 return strlen($string);
35 /**
36 * Returns substring from string, works depending on current charset.
38 * @param string $string string to count
39 * @param int $start start of substring
40 * @param int $length length of substring
42 * @return string the sub string
44 public function substr($string, $start, $length = 2147483647)
46 return substr($string, $start, $length);
49 /**
50 * Returns postion of $needle in $haystack or false if not found
52 * @param string $haystack the string being checked
53 * @param string $needle the string to find in haystack
54 * @param int $offset the search offset
56 * @return integer position of $needle in $haystack or false
58 public function strpos($haystack, $needle, $offset = 0)
60 return strpos($haystack, $needle, $offset);
63 /**
64 * Make a string lowercase
66 * @param string $string the string being lowercased
68 * @return string the lower case string
70 public function strtolower($string)
72 return strtolower($string);
75 /**
76 * Get the ordinal value of a string
78 * @param string $string the string for which ord is required
80 * @return string the ord value
82 public function ord($string)
84 return ord($string);