Merge remote-tracking branch 'origin/QA_4_0' into QA_4_0
[phpmyadmin.git] / libraries / string_native.lib.php
blob4154959efcecdc37c3749b052762286e53a35ac5
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Specialized String Functions for phpMyAdmin
6 * Defines a set of function callbacks that have a pure C version available if
7 * the "ctype" extension is available, but otherwise have PHP versions to use
8 * (that are slower).
10 * The SQL Parser code relies heavily on these functions.
12 * @package PhpMyAdmin-String
13 * @subpackage Native
15 if (! defined('PHPMYADMIN')) {
16 exit;
19 /**
20 * Returns length of string depending on current charset.
22 * @param string $string string to count
24 * @return int string length
26 function PMA_strlen($string)
28 return strlen($string);
31 /**
32 * Returns substring from string, works depending on current charset.
34 * @param string $string string to count
35 * @param int $start start of substring
36 * @param int $length length of substring
38 * @return string the sub string
40 function PMA_substr($string, $start, $length = 2147483647)
42 return substr($string, $start, $length);
45 /**
46 * Returns postion of $needle in $haystack or false if not found
48 * @param string $haystack the string being checked
49 * @param string $needle the string to find in haystack
50 * @param int $offset the search offset
52 * @return integer position of $needle in $haystack or false
54 function PMA_strpos($haystack, $needle, $offset = 0)
56 return strpos($haystack, $needle, $offset);
59 /**
60 * Make a string lowercase
62 * @param string $string the string being lowercased
64 * @return string the lower case string
66 function PMA_strtolower($string)
68 return strtolower($string);