PHP strtr 函式使用說明

2022-09-26 18:54:15 字數 709 閱讀 4071

定義和用法

strtr() 函式轉換字串中特定的字元。

語法 strtr(string,from,to)或者

strtr(string,array)引數 描述

string1 必需。規定要轉換的字串。

from 必需(除非使用陣列)。規定要改變的字元。

to 必需(除非使用陣列)。規定要改變為的字元。

array 必需(除非使用 from 和 to)。乙個陣列,其程式設計客棧中的鍵是原始字元,值是目標字元。

說明 如果 from 和 to 的長度不同,則格式化為最短的長度。 程式設計客棧

例子 例子www.cppcns.com 1

複製** **如下:

php

echo strtr("hilla warld","ia","eo");

?>

輸出:

hello world例子 2

複製** **如下:

<?php

$arr = array("hello" => "hi", "world" => "earth");

echo strtr("hello world",$arr);

?>

輸出:

hi ea程式設計客棧rth

本文標題: php strtr() 函式使用說明

本文位址: /wangluo/php/45527.html

memset 函式使用說明

sets buffers to a specified character.void memset void dest intc size tcount example memset.c this program uses memset to set the first four bytes of ...

php header 函式使用說明

php只是以http協議將html文件的標頭送到瀏覽器,告訴瀏覽器具體怎麼處理這個頁面,至於傳送的內容則需要熟悉一下http協議了,與php無關了,可參照 header 函式使用說明 一 作用 php只是以http協議將html文件的標頭送到瀏覽器,告訴瀏覽器具體怎麼處理這個頁面,至於傳送的內容則需...

linux open 函式使用說明

open 函式用於開啟和建立檔案。以下是open 函式的簡單描述 include int open const char pathname,int oflag,返回值 成功則返回檔案描述符,否則返回 1 對於 open 函式來說,第三個引數 僅當建立新檔案時才使用,用於指定檔案的訪問許可權位 acc...