Hướng dẫn valid predefined functions in php to manipulate string are - các hàm được xác định trước hợp lệ trong php để thao tác chuỗi là

Mục lục

  • addcslashes - Chuỗi trích dẫn với dấu gạch chéo theo kiểu C
  • AddSlashes - Chuỗi trích dẫn với dấu gạch chéo
  • BIN2HEX - Chuyển đổi dữ liệu nhị phân thành biểu diễn thập lục phân
  • CHOP - Bí danh của rtrim
  • chr-tạo một chuỗi một byte từ một số
  • Chunk_split - Chia một chuỗi thành các khối nhỏ hơn
  • Convert_Cyr_String - Chuyển đổi từ một ký tự cyrillic sang một ký tự khác
  • convert_uudecode - giải mã chuỗi uuencoded
  • convert_uuencode - uuencode một chuỗi
  • Count_chars - Trả về thông tin về các ký tự được sử dụng trong một chuỗi
  • CRC32 - Tính toán đa thức CRC32 của chuỗi
  • Crypt-Chuỗi một chiều băm
  • Echo - đầu ra một hoặc nhiều chuỗi
  • Explode - Chia một chuỗi theo chuỗi
  • fprintf - viết một chuỗi được định dạng vào một luồng
  • get_html_translation_table - Trả về bảng dịch được sử dụng bởi htmlspecialchars và htmlentities
  • Hebrev - Chuyển đổi văn bản tiếng Do Thái logic sang văn bản trực quan
  • Hebrevc - Chuyển đổi văn bản tiếng Do Thái logic sang văn bản trực quan với chuyển đổi dòng mới
  • hex2bin - Giải mã chuỗi nhị phân được mã hóa theo hình lục giác
  • HTML_ENTITY_DECODE - Chuyển đổi các thực thể HTML thành các ký tự tương ứng của chúng
  • HTMLENTITY - Chuyển đổi tất cả các ký tự áp dụng thành các thực thể HTML
  • htmlspecialchars_decode - Chuyển đổi các thực thể HTML đặc biệt trở lại các ký tự
  • HTMLSPECIALCHARS - Chuyển đổi các ký tự đặc biệt thành các thực thể HTML
  • Illustode - tham gia các phần tử mảng với một chuỗi
  • Tham gia - Bí danh của sự nổ tung
  • LCFIRST - Tạo chữ thường ký tự đầu tiên của chuỗi
  • Levenshtein - Tính khoảng cách Levenshtein giữa hai chuỗi
  • Localeconv - Nhận thông tin định dạng số
  • LTRIM - Dải khoảng trắng (hoặc các ký tự khác) từ đầu chuỗi
  • MD5_FILE - Tính băm MD5 của một tệp đã cho
  • MD5 - Tính băm MD5 của chuỗi
  • Metaphone - Tính phím Metaphone của chuỗi
  • Money_Format - Định dạng một số dưới dạng chuỗi tiền tệ
  • NL_LANGINFO - Ngôn ngữ truy vấn và thông tin địa phương
  • NL2BR - Chèn dòng HTML bị hỏng trước tất cả các dòng mới trong một chuỗi
  • number_format - định dạng một số có hàng ngàn
  • Ord - Chuyển đổi byte đầu tiên của chuỗi thành giá trị từ 0 đến 255
  • parse_str - phân chia chuỗi thành các biến
  • in - xuất một chuỗi
  • printf - xuất một chuỗi được định dạng
  • Trích dẫn_printable_decode-Chuyển đổi chuỗi được in được trích dẫn thành chuỗi 8 bit
  • trích dẫn_printable_encode-Chuyển đổi chuỗi 8 bit thành chuỗi được in được in
  • QuoteMeta - Trích dẫn ký tự meta
  • RTRIM - Dải khoảng trắng (hoặc các ký tự khác) từ cuối chuỗi
  • SetLocale - Đặt thông tin địa phương
  • SHA1_FILE - Tính băm SHA1 của tệp
  • SHA1 - Tính băm SHA1 của chuỗi
  • tương tự_Text - Tính toán sự tương đồng giữa hai chuỗi
  • SoundEx - Tính phím SoundEx của chuỗi
  • Sprintf - Trả về chuỗi được định dạng
  • SSCANF - Đầu vào phân tích cú pháp từ một chuỗi theo định dạng
  • STR_CONTAINS - Xác định xem một chuỗi có chứa bộ nền nhất định không
  • str_ends_with - kiểm tra xem một chuỗi kết thúc bằng một chuỗi con nhất định
  • str_getcsv - phân tích chuỗi CSV thành một mảng
  • str_ireplace-phiên bản không nhạy cảm của trường hợp của str_replace
  • str_pad - pad một chuỗi đến một độ dài nhất định với một chuỗi khác
  • STR_REPEAT - Lặp lại một chuỗi
  • str_replace - Thay thế tất cả các lần xuất hiện của chuỗi tìm kiếm bằng chuỗi thay thế
  • str_rot13 - thực hiện biến đổi rot13 trên chuỗi
  • str_shuffle - ngẫu nhiên xáo trộn một chuỗi
  • STR_SPLIT - Chuyển đổi chuỗi thành một mảng
  • STR_STARTS_WITH - Kiểm tra xem một chuỗi bắt đầu bằng một chuỗi con nhất định
  • str_word_count - trả về thông tin về các từ được sử dụng trong một chuỗi
  • STRCASECMP-So sánh chuỗi không phân biệt trường hợp an toàn nhị phân
  • Strchr - Bí danh của Strstr
  • STRCMP - So sánh chuỗi an toàn nhị phân
  • Strcoll - So sánh chuỗi dựa trên địa phương
  • strcspn - Tìm độ dài của phân đoạn ban đầu không khớp mặt nạ
  • Dải_tags - Thẻ HTML và PHP thoát khỏi chuỗi từ một chuỗi
  • dảicslashes-chuỗi không truy thích được trích dẫn với addcslashes
  • Stripos-Tìm vị trí của lần xuất hiện đầu tiên của chuỗi con không nhạy trong trường hợp trong một chuỗi
  • Stripslashes-Un-Rotes một chuỗi được trích dẫn
  • Stristr-Strstrs không nhạy cảm trường hợp
  • Strlen - Nhận độ dài chuỗi
  • Strnatcasecmp - Trường hợp so sánh chuỗi không nhạy cảm bằng thuật toán "thứ tự tự nhiên"
  • Strnatcmp - So sánh chuỗi bằng thuật toán "thứ tự tự nhiên"
  • Strncasecmp-Chuỗi phân tích không phân biệt trường hợp an toàn nhị phân của các ký tự N đầu tiên
  • strncmp - so sánh chuỗi an toàn nhị phân của n ký tự đầu tiên
  • strpbrk - tìm kiếm một chuỗi cho bất kỳ bộ ký tự nào
  • Strpos - Tìm vị trí của lần xuất hiện đầu tiên của chuỗi con trong chuỗi
  • Strrchr - Tìm lần xuất hiện cuối cùng của một ký tự trong chuỗi
  • strrev - đảo ngược một chuỗi
  • Strripos-Tìm vị trí của lần xuất hiện cuối cùng của chuỗi con không nhạy trong trường hợp trong một chuỗi
  • strrpos - Tìm vị trí của lần xuất hiện cuối cùng của chuỗi con trong chuỗi
  • STRSPN - Tìm độ dài của đoạn ban đầu của một chuỗi bao gồm hoàn toàn các ký tự có trong một mặt nạ nhất định
  • Strstr - Tìm lần xuất hiện đầu tiên của chuỗi
  • Strtok - Chuỗi mã thông báo
  • Strtolower - Tạo chữ thường chuỗi
  • strtouper - tạo một chuỗi chữ hoa
  • STRTR - dịch các ký tự hoặc thay thế các chuỗi con
  • SPERTR_COMPARE - So sánh an toàn nhị phân của hai chuỗi từ phần bù, lên đến các ký tự dài
  • SPERTR_COUNT - Đếm số lượng lần xuất hiện
  • SPERTR_REPLACE - Thay thế văn bản trong một phần của chuỗi
  • Subrtr - trả về phần của chuỗi
  • Cắt - dải trắng (hoặc các ký tự khác) từ đầu và cuối chuỗi
  • UCFIRST - Tạo nhân vật chữ hoa đầu tiên của chuỗi
  • ucwords - chữ hoa, ký tự đầu tiên của mỗi từ trong một chuỗi
  • UTF8_DECODE-Chuyển đổi một chuỗi từ UTF-8 thành ISO-8859-1, thay thế các ký tự không hợp lệ hoặc không thể trình bày
  • UTF8_ENCODE-Chuyển đổi một chuỗi từ ISO-8859-1 thành UTF-8
  • VFPrintf - Viết chuỗi được định dạng vào luồng
  • vprintf - xuất trình chuỗi được định dạng
  • vsprintf - trả về chuỗi được định dạng
  • WordWrap - Kết thúc một chuỗi thành một số ký tự đã cho

lrirwin tại alum dot wustl dot edu ¶

1 năm trước

I'm converting 30 year old code and needed a string TAB function:

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }

  $pline="String with this tab to 50 and";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
  $pline="101010101020202020203030303030404040404050505050506060606060";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;

  //Results in this output:
  //String with this tab to 50 and                   finish it.
  //1010101010202020202030303030304040404040505050505finish it.

PHP tại Moechofe dot com ¶

17 năm trước

  /*
  * str_match
  *
  * return a string with only cacacteres defined in a expression return false if the expression is not valid
  *
  * @param $str string the string
  * @param $match the expression based on the class definition off a PCRE regular expression.
  *   the '[', ']', '\' and '^' at class start need to be escaped.
  *   like : -a-z0-9_@.
  */
 
function str_match( $str, $match )
  {
   
$return = '';
    if(
eregi( '(.*)', $match, $class ) )
    {
     
$match = '['.$regs[1].']';
      for(
$i=0; $i<strlen($str); $i++ )
      if(
ereg( '['.$class[1].']', $str[$i] ) )
     
$return .= $str{$i};
      return
$return;
    }
    else return
false;
  }
/*
  * example
  * accept only alphanum caracteres from the GET/POST parameters 'a'
  */
if( ! empty($_REQUEST['a']) )
   
$_REQUEST['a'] = str_match( $_REQUEST['a'], 'a-zA-Z0-9' );
  else
   
$_REQUEST['a'] = 'default';
?>

Quản trị viên tại Fivestarbuy dot com

17 năm trước

This example lets you parse an unparsed strings variables. Warning: This could cause security leaks if you allow users to pass $variables through this engine. I recommend only using this for your Content Management System.

$mytime=time();
$mydog="My Dog Ate My PHP!";

# Your Parsing String:
$s1 = 'Hyphen Variable Preserving: $mytime, and $mydog';
echo "Before:

$s1

";

# Remember, wherever you define this, it will not be defined GLOBAL into the function
# which is why we define it here. Defining it global could lead to security issues.
$vardata=get_defined_vars();

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
0

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
1

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
2

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
3

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
4

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
5

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
6

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
7

Quản trị viên tại Fivestarbuy dot com

17 năm trước

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
9

Quản trị viên tại Fivestarbuy dot com

  $pline="String with this tab to 50 and";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
  $pline="101010101020202020203030303030404040404050505050506060606060";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
0

  $pline="String with this tab to 50 and";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
  $pline="101010101020202020203030303030404040404050505050506060606060";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
1

  $pline="String with this tab to 50 and";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
  $pline="101010101020202020203030303030404040404050505050506060606060";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
2

t0russ tại gmail dot com ¶

17 năm trước

  $pline="String with this tab to 50 and";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
  $pline="101010101020202020203030303030404040404050505050506060606060";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
4

  $pline="String with this tab to 50 and";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
  $pline="101010101020202020203030303030404040404050505050506060606060";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
5

  $pline="String with this tab to 50 and";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
  $pline="101010101020202020203030303030404040404050505050506060606060";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
6

  $pline="String with this tab to 50 and";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
  $pline="101010101020202020203030303030404040404050505050506060606060";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
7

  $pline="String with this tab to 50 and";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
  $pline="101010101020202020203030303030404040404050505050506060606060";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
8

Quản trị viên tại Fivestarbuy dot com

  $pline="String with this tab to 50 and";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
  $pline="101010101020202020203030303030404040404050505050506060606060";
  $tline=tab($pline,50)."finish it.";
  echo $tline.PHP_EOL;
9

  //Results in this output:
  //String with this tab to 50 and                   finish it.
  //1010101010202020202030303030304040404040505050505finish it.
0

  //Results in this output:
  //String with this tab to 50 and                   finish it.
  //1010101010202020202030303030304040404040505050505finish it.
1

  //Results in this output:
  //String with this tab to 50 and                   finish it.
  //1010101010202020202030303030304040404040505050505finish it.
2

t0russ tại gmail dot com ¶

Verdauga ¶

  //Results in this output:
  //String with this tab to 50 and                   finish it.
  //1010101010202020202030303030304040404040505050505finish it.
3

  //Results in this output:
  //String with this tab to 50 and                   finish it.
  //1010101010202020202030303030304040404040505050505finish it.
4

  //Results in this output:
  //String with this tab to 50 and                   finish it.
  //1010101010202020202030303030304040404040505050505finish it.
5

  //Results in this output:
  //String with this tab to 50 and                   finish it.
  //1010101010202020202030303030304040404040505050505finish it.
6

  //Results in this output:
  //String with this tab to 50 and                   finish it.
  //1010101010202020202030303030304040404040505050505finish it.
7

  //Results in this output:
  //String with this tab to 50 and                   finish it.
  //1010101010202020202030303030304040404040505050505finish it.
8

  //Results in this output:
  //String with this tab to 50 and                   finish it.
  //1010101010202020202030303030304040404040505050505finish it.
9

14 năm trước

Verdauga ¶

1

2

14 năm trước

17 năm trước

4

5

Quản trị viên tại Fivestarbuy dot com

7

8

9

t0russ tại gmail dot com ¶

Verdauga ¶

  /*
  * str_match
  *
  * return a string with only cacacteres defined in a expression return false if the expression is not valid
  *
  * @param $str string the string
  * @param $match the expression based on the class definition off a PCRE regular expression.
  *   the '[', ']', '\' and '^' at class start need to be escaped.
  *   like : -a-z0-9_@.
  */
 
function str_match( $str, $match )
  {
   
$return = '';
    if(
eregi( '(.*)', $match, $class ) )
    {
     
$match = '['.$regs[1].']';
      for(
$i=0; $i<strlen($str); $i++ )
      if(
ereg( '['.$class[1].']', $str[$i] ) )
     
$return .= $str{$i};
      return
$return;
    }
    else return
false;
  }
/*
  * example
  * accept only alphanum caracteres from the GET/POST parameters 'a'
  */
if( ! empty($_REQUEST['a']) )
   
$_REQUEST['a'] = str_match( $_REQUEST['a'], 'a-zA-Z0-9' );
  else
   
$_REQUEST['a'] = 'default';
?>
1

  /*
  * str_match
  *
  * return a string with only cacacteres defined in a expression return false if the expression is not valid
  *
  * @param $str string the string
  * @param $match the expression based on the class definition off a PCRE regular expression.
  *   the '[', ']', '\' and '^' at class start need to be escaped.
  *   like : -a-z0-9_@.
  */
 
function str_match( $str, $match )
  {
   
$return = '';
    if(
eregi( '(.*)', $match, $class ) )
    {
     
$match = '['.$regs[1].']';
      for(
$i=0; $i<strlen($str); $i++ )
      if(
ereg( '['.$class[1].']', $str[$i] ) )
     
$return .= $str{$i};
      return
$return;
    }
    else return
false;
  }
/*
  * example
  * accept only alphanum caracteres from the GET/POST parameters 'a'
  */
if( ! empty($_REQUEST['a']) )
   
$_REQUEST['a'] = str_match( $_REQUEST['a'], 'a-zA-Z0-9' );
  else
   
$_REQUEST['a'] = 'default';
?>
2

Quản trị viên tại Fivestarbuy dot com

  /*
  * str_match
  *
  * return a string with only cacacteres defined in a expression return false if the expression is not valid
  *
  * @param $str string the string
  * @param $match the expression based on the class definition off a PCRE regular expression.
  *   the '[', ']', '\' and '^' at class start need to be escaped.
  *   like : -a-z0-9_@.
  */
 
function str_match( $str, $match )
  {
   
$return = '';
    if(
eregi( '(.*)', $match, $class ) )
    {
     
$match = '['.$regs[1].']';
      for(
$i=0; $i<strlen($str); $i++ )
      if(
ereg( '['.$class[1].']', $str[$i] ) )
     
$return .= $str{$i};
      return
$return;
    }
    else return
false;
  }
/*
  * example
  * accept only alphanum caracteres from the GET/POST parameters 'a'
  */
if( ! empty($_REQUEST['a']) )
   
$_REQUEST['a'] = str_match( $_REQUEST['a'], 'a-zA-Z0-9' );
  else
   
$_REQUEST['a'] = 'default';
?>
4

  /*
  * str_match
  *
  * return a string with only cacacteres defined in a expression return false if the expression is not valid
  *
  * @param $str string the string
  * @param $match the expression based on the class definition off a PCRE regular expression.
  *   the '[', ']', '\' and '^' at class start need to be escaped.
  *   like : -a-z0-9_@.
  */
 
function str_match( $str, $match )
  {
   
$return = '';
    if(
eregi( '(.*)', $match, $class ) )
    {
     
$match = '['.$regs[1].']';
      for(
$i=0; $i<strlen($str); $i++ )
      if(
ereg( '['.$class[1].']', $str[$i] ) )
     
$return .= $str{$i};
      return
$return;
    }
    else return
false;
  }
/*
  * example
  * accept only alphanum caracteres from the GET/POST parameters 'a'
  */
if( ! empty($_REQUEST['a']) )
   
$_REQUEST['a'] = str_match( $_REQUEST['a'], 'a-zA-Z0-9' );
  else
   
$_REQUEST['a'] = 'default';
?>
5

  /*
  * str_match
  *
  * return a string with only cacacteres defined in a expression return false if the expression is not valid
  *
  * @param $str string the string
  * @param $match the expression based on the class definition off a PCRE regular expression.
  *   the '[', ']', '\' and '^' at class start need to be escaped.
  *   like : -a-z0-9_@.
  */
 
function str_match( $str, $match )
  {
   
$return = '';
    if(
eregi( '(.*)', $match, $class ) )
    {
     
$match = '['.$regs[1].']';
      for(
$i=0; $i<strlen($str); $i++ )
      if(
ereg( '['.$class[1].']', $str[$i] ) )
     
$return .= $str{$i};
      return
$return;
    }
    else return
false;
  }
/*
  * example
  * accept only alphanum caracteres from the GET/POST parameters 'a'
  */
if( ! empty($_REQUEST['a']) )
   
$_REQUEST['a'] = str_match( $_REQUEST['a'], 'a-zA-Z0-9' );
  else
   
$_REQUEST['a'] = 'default';
?>
6

  /*
  * str_match
  *
  * return a string with only cacacteres defined in a expression return false if the expression is not valid
  *
  * @param $str string the string
  * @param $match the expression based on the class definition off a PCRE regular expression.
  *   the '[', ']', '\' and '^' at class start need to be escaped.
  *   like : -a-z0-9_@.
  */
 
function str_match( $str, $match )
  {
   
$return = '';
    if(
eregi( '(.*)', $match, $class ) )
    {
     
$match = '['.$regs[1].']';
      for(
$i=0; $i<strlen($str); $i++ )
      if(
ereg( '['.$class[1].']', $str[$i] ) )
     
$return .= $str{$i};
      return
$return;
    }
    else return
false;
  }
/*
  * example
  * accept only alphanum caracteres from the GET/POST parameters 'a'
  */
if( ! empty($_REQUEST['a']) )
   
$_REQUEST['a'] = str_match( $_REQUEST['a'], 'a-zA-Z0-9' );
  else
   
$_REQUEST['a'] = 'default';
?>
7

  /*
  * str_match
  *
  * return a string with only cacacteres defined in a expression return false if the expression is not valid
  *
  * @param $str string the string
  * @param $match the expression based on the class definition off a PCRE regular expression.
  *   the '[', ']', '\' and '^' at class start need to be escaped.
  *   like : -a-z0-9_@.
  */
 
function str_match( $str, $match )
  {
   
$return = '';
    if(
eregi( '(.*)', $match, $class ) )
    {
     
$match = '['.$regs[1].']';
      for(
$i=0; $i<strlen($str); $i++ )
      if(
ereg( '['.$class[1].']', $str[$i] ) )
     
$return .= $str{$i};
      return
$return;
    }
    else return
false;
  }
/*
  * example
  * accept only alphanum caracteres from the GET/POST parameters 'a'
  */
if( ! empty($_REQUEST['a']) )
   
$_REQUEST['a'] = str_match( $_REQUEST['a'], 'a-zA-Z0-9' );
  else
   
$_REQUEST['a'] = 'default';
?>
8

t0russ tại gmail dot com ¶

This example lets you parse an unparsed strings variables. Warning: This could cause security leaks if you allow users to pass $variables through this engine. I recommend only using this for your Content Management System.0

This example lets you parse an unparsed strings variables. Warning: This could cause security leaks if you allow users to pass $variables through this engine. I recommend only using this for your Content Management System.1

t0russ tại gmail dot com ¶

Verdauga ¶

This example lets you parse an unparsed strings variables. Warning: This could cause security leaks if you allow users to pass $variables through this engine. I recommend only using this for your Content Management System.3

This example lets you parse an unparsed strings variables. Warning: This could cause security leaks if you allow users to pass $variables through this engine. I recommend only using this for your Content Management System.4

This example lets you parse an unparsed strings variables. Warning: This could cause security leaks if you allow users to pass $variables through this engine. I recommend only using this for your Content Management System.5

This example lets you parse an unparsed strings variables. Warning: This could cause security leaks if you allow users to pass $variables through this engine. I recommend only using this for your Content Management System.6

This example lets you parse an unparsed strings variables. Warning: This could cause security leaks if you allow users to pass $variables through this engine. I recommend only using this for your Content Management System.7

Quản trị viên tại Fivestarbuy dot com

17 năm trước

This example lets you parse an unparsed strings variables. Warning: This could cause security leaks if you allow users to pass $variables through this engine. I recommend only using this for your Content Management System.9

$mytime=time();
$mydog="My Dog Ate My PHP!";
0

$mytime=time();
$mydog="My Dog Ate My PHP!";
1

$mytime=time();
$mydog="My Dog Ate My PHP!";
2

$mytime=time();
$mydog="My Dog Ate My PHP!";
3

$mytime=time();
$mydog="My Dog Ate My PHP!";
4

Quản trị viên tại Fivestarbuy dot com

17 năm trước

$mytime=time();
$mydog="My Dog Ate My PHP!";
6

$mytime=time();
$mydog="My Dog Ate My PHP!";
7

$mytime=time();
$mydog="My Dog Ate My PHP!";
8

$mytime=time();
$mydog="My Dog Ate My PHP!";
9

# Your Parsing String:
$s1 = 'Hyphen Variable Preserving: $mytime, and $mydog';
echo "Before:

$s1

";
0

# Your Parsing String:
$s1 = 'Hyphen Variable Preserving: $mytime, and $mydog';
echo "Before:

$s1

";
1

Quản trị viên tại Fivestarbuy dot com

17 năm trước

# Your Parsing String:
$s1 = 'Hyphen Variable Preserving: $mytime, and $mydog';
echo "Before:

$s1

";
2

# Your Parsing String:
$s1 = 'Hyphen Variable Preserving: $mytime, and $mydog';
echo "Before:

$s1

";
3

# Your Parsing String:
$s1 = 'Hyphen Variable Preserving: $mytime, and $mydog';
echo "Before:

$s1

";
4

# Your Parsing String:
$s1 = 'Hyphen Variable Preserving: $mytime, and $mydog';
echo "Before:

$s1

";
5

Quản trị viên tại Fivestarbuy dot com

Verdauga ¶

# Your Parsing String:
$s1 = 'Hyphen Variable Preserving: $mytime, and $mydog';
echo "Before:

$s1

";
6

# Your Parsing String:
$s1 = 'Hyphen Variable Preserving: $mytime, and $mydog';
echo "Before:

$s1

";
7

14 năm trước

# Your Parsing String:
$s1 = 'Hyphen Variable Preserving: $mytime, and $mydog';
echo "Before:

$s1

";
9

# Remember, wherever you define this, it will not be defined GLOBAL into the function
# which is why we define it here. Defining it global could lead to security issues.
$vardata=get_defined_vars();
0

# Remember, wherever you define this, it will not be defined GLOBAL into the function
# which is why we define it here. Defining it global could lead to security issues.
$vardata=get_defined_vars();
1

# Remember, wherever you define this, it will not be defined GLOBAL into the function
# which is why we define it here. Defining it global could lead to security issues.
$vardata=get_defined_vars();
2

# Remember, wherever you define this, it will not be defined GLOBAL into the function
# which is why we define it here. Defining it global could lead to security issues.
$vardata=get_defined_vars();
3

# Remember, wherever you define this, it will not be defined GLOBAL into the function
# which is why we define it here. Defining it global could lead to security issues.
$vardata=get_defined_vars();
4

t0russ tại gmail dot com ¶

17 năm trước

# Remember, wherever you define this, it will not be defined GLOBAL into the function
# which is why we define it here. Defining it global could lead to security issues.
$vardata=get_defined_vars();
5

# Remember, wherever you define this, it will not be defined GLOBAL into the function
# which is why we define it here. Defining it global could lead to security issues.
$vardata=get_defined_vars();
6

# Remember, wherever you define this, it will not be defined GLOBAL into the function
# which is why we define it here. Defining it global could lead to security issues.
$vardata=get_defined_vars();
7

# Remember, wherever you define this, it will not be defined GLOBAL into the function
# which is why we define it here. Defining it global could lead to security issues.
$vardata=get_defined_vars();
8

# Remember, wherever you define this, it will not be defined GLOBAL into the function
# which is why we define it here. Defining it global could lead to security issues.
$vardata=get_defined_vars();
9

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
00

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
01

Quản trị viên tại Fivestarbuy dot com

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
03

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
04

t0russ tại gmail dot com ¶

Verdauga ¶

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
06

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
07

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
08

  //tab function similar to TAB used in old BASIC languages
  //though some of them did not truncate if the string were
  //longer than the requested position
  function tab($instring="",$topos=0){
    if(strlen($instring)<$topos){
      $result=str_pad($instring,$topos-1," ",STR_PAD_RIGHT);
    }else{
      $result=substr($instring,0,$topos-1);
    }
    return $result;
  }
09

Làm thế nào chuỗi được thao tác trong PHP?

Các chức năng thao tác chuỗi khác nhau trong PHP..
Strlen (): Điều này được sử dụng để tìm độ dài của chuỗi.....
STR_WORD_COUNT (): Để tìm số lượng từ trong một chuỗi.....
str_rev (): Để đảo ngược một chuỗi.....
strpos (): Để tìm kiếm một chuỗi cụ thể.....
str_replace (): Thay thế văn bản bằng một chuỗi ..

Hàm được xác định trước trong chuỗi là gì?

Chuỗi chức năng.

Có bao nhiêu chức năng chuỗi trong PHP?

Chức năng chuỗi PHP.

Các loại chức năng thao tác chuỗi là gì?

Các hàm điều khiển chuỗi chấp nhận các đối số của loại char, nchar, varchar, nvarchar hoặc lvarchar.Bạn có thể sử dụng chức năng điều khiển chuỗi bất cứ nơi nào bạn sử dụng biểu thức.Các chức năng sau đây chuyển đổi giữa các chữ cái trên và chữ thường trong một chuỗi ký tự: thấp hơn.CHAR, NCHAR, VARCHAR, NVARCHAR, or LVARCHAR. You can use a string-manipulation function anywhere you use an expression. The following functions convert between upper and lowercase letters in a character string: LOWER.