home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / phpMyAdmin / libraries / string_native.lib.php < prev    next >
Encoding:
PHP Script  |  2008-06-23  |  2.0 KB  |  78 lines

  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4.  * Specialized String Functions for phpMyAdmin
  5.  *
  6.  * Copyright 2002 Robin Johnson <robbat2@users.sourceforge.net>
  7.  * http://www.orbis-terrarum.net/?l=people.robbat2
  8.  *
  9.  * Defines a set of function callbacks that have a pure C version available if
  10.  * the "ctype" extension is available, but otherwise have PHP versions to use
  11.  * (that are slower).
  12.  *
  13.  * The SQL Parser code relies heavily on these functions.
  14.  *
  15.  * @version $Id: string_native.lib.php 10294 2007-04-17 11:59:09Z cybot_tm $
  16.  */
  17.  
  18. /**
  19.  * Returns length of string depending on current charset.
  20.  *
  21.  * @uses    strlen()
  22.  * @param   string   string to count
  23.  * @return  int      string length
  24.  * @access  public
  25.  * @author  nijel
  26.  * @todo rename to PM_STR_len()
  27.  */
  28. function PMA_strlen($string)
  29. {
  30.     return strlen($string);
  31. }
  32.  
  33. /**
  34.  * Returns substring from string, works depending on current charset.
  35.  *
  36.  * @uses    substr()
  37.  * @param   string   string to count
  38.  * @param   int      start of substring
  39.  * @param   int      length of substring
  40.  * @return  int      substring
  41.  * @access  public
  42.  * @author  nijel
  43.  * @todo rename to PM_STR_sub()
  44.  */
  45. function PMA_substr($string, $start, $length = 2147483647)
  46. {
  47.     return substr($string, $start, $length);
  48. }
  49.  
  50. /**
  51.  * returns postion of $needle in $haystack or false if not found
  52.  *
  53.  * @uses    strpos()
  54.  * @param   string  $needle
  55.  * @param   string  $haystack
  56.  * @return  integer position of $needle in $haystack or false
  57.  */
  58. function PMA_STR_pos($haystack, $needle, $offset = 0)
  59. {
  60.     return strpos($haystack, $needle, $offset);
  61. }
  62.  
  63. /**
  64.  * returns right most postion of $needle in $haystack or false if not found
  65.  *
  66.  * @uses    strrpos()
  67.  * @param   string  $needle
  68.  * @param   string  $haystack
  69.  * @return  integer position of $needle in $haystack or false
  70.  * @todo    add workaround for PHP < 5.0.0 only first char of $needle is used
  71.  */
  72. function PMA_STR_rPos($haystack, $needle, $offset = 0)
  73. {
  74.     return strrpos($haystack, $needle, $offset);
  75. }
  76.  
  77. ?>
  78.