"PHP strtr()"의 두 판 사이의 차이

 
(사용자 2명의 중간 판 5개는 보이지 않습니다)
3번째 줄: 3번째 줄:
* "string translate"
* "string translate"


<source lang='php'>
<syntaxhighlight lang='php' run>
echo strtr("Hilla Warld","ia","eo");
echo strtr("Hilla Warld","ia","eo"); # Hello World
# Hello World
</syntaxhighlight>
</source>
<syntaxhighlight lang='php' run>
<source lang='php'>
$trans = ["h" => "-", "hello" => "hi", "hi" => "hello"];
$trans = ["h" => "-", "hello" => "hi", "hi" => "hello"];
echo strtr("hi all, I said hello", $trans);
echo strtr("hi all, I said hello", $trans); # hello all, I said hi
# hello all, I said hi
</syntaxhighlight>
</source>
<syntaxhighlight lang='php' run>
echo strtr("baab", "ab", "01") . "\n";
echo strtr("baab", ["ab" => "01"]) . "\n";
</syntaxhighlight>


==같이 보기==
==같이 보기==
19번째 줄: 21번째 줄:


==참고==
==참고==
* http://php.net/manual/kr/function.strtr.php
* http://php.net/manual/en/function.strtr.php
* https://www.w3schools.com/php/func_string_strtr.asp
* https://www.w3schools.com/php/func_string_strtr.asp
* https://www.w3resource.com/php/function-reference/strtr.php
* https://www.w3resource.com/php/function-reference/strtr.php


[[분류: PHP 문자열 함수]]
[[분류: PHP 문자열 함수]]

2022년 4월 29일 (금) 13:20 기준 최신판

1 개요[ | ]

PHP strtr()
  • "string translate"
echo strtr("Hilla Warld","ia","eo"); # Hello World
$trans = ["h" => "-", "hello" => "hi", "hi" => "hello"];
echo strtr("hi all, I said hello", $trans); # hello all, I said hi
echo strtr("baab", "ab", "01") . "\n";
echo strtr("baab", ["ab" => "01"]) . "\n";

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}