Contoh
Cetak tabel terjemahan yang digunakan oleh fungsi htmlspecialchars:
<?php
print_r (get_html_translation_table()); // HTML_SPECIALCHARS is default.
?>
Menjalankan contoh » Definisi dan Penggunaan
The get_html_translation_table() mengembalikan fungsi tabel terjemahan yang digunakan oleh htmlentities() dan htmlspecialchars() fungsi.
Tip: Beberapa karakter dapat dikodekan beberapa cara. The get_html_translation_table() mengembalikan fungsi encoding paling umum.
Sintaksis
get_html_translation_table( function,flags,character-set )
Parameter | Deskripsi |
---|---|
function | Pilihan. Menentukan yang tabel terjemahan untuk kembali. Kemungkinan nilai:
|
flags | Pilihan. Menentukan yang mengutip tabel akan berisi dan mana dokumen ketik tabel adalah untuk. Gaya kutipan yang tersedia adalah:
bendera tambahan untuk menspesifikasikan doctype meja adalah untuk:
|
character-set | Pilihan. Sebuah string yang menentukan karakter-diatur untuk menggunakan. nilai yang diperbolehkan adalah:
Note: tidak dikenal karakter-set akan diabaikan dan diganti dengan ISO-8859-1 versi sebelum PHP 5.4. Sebagai PHP 5.4, akan diabaikan sebuah diganti dengan UTF-8. |
Rincian teknis
Kembali Nilai: | Mengembalikan tabel terjemahan sebagai array, dengan karakter asli sebagai kunci dan entitas sebagai nilai-nilai |
---|---|
PHP Versi: | 4+ |
changelog: | Nilai default untuk parameter karakter-set diubah menjadi UTF-8 di PHP 5 Tambahan bendera untuk menspesifikasikan doctype meja adalah untuk; ENT_HTML401, ENT_HTML5, ENT_XML1 dan ENT_XHTML ditambahkan di PHP 5.4 Karakter-set parameter ditambahkan di PHP 5.3.4 |
Contoh lebih
Contoh
Tabel untuk HTML_SPECIALCHARS:
<?php
print_r (get_html_translation_table(HTML_SPECIALCHARS));
?>
Menampilkan karakter dan entitas nama:
Array
(
["] => "
[&] => &
[<] => <
[>] => >
)
contoh 2
Tabel untuk HTML_ENTITIES:
<?php
print_r (get_html_translation_table(HTML_ENTITIES));
?>
Menampilkan karakter dan entitas nama:
Array
(
["] => "
[&] => &
[<] => <
[>] => >
[ ] =>
[] => ¡
[] => ¢
[] => £
[] =>
¤
[] => ¥
[] => ¦
[] => §
[] => ¨
[] => ©
[] => ª
[] => «
[] => ¬
[] =>
­
[] => ®
[] => ¯
[] => °
[] => ±
[] => ²
[] => ³
[] => ´
[] => µ
[] =>
¶
[] => ·
[] => ¸
[] => ¹
[] => º
[] => »
[] => ¼
[] => ½
[] => ¾
[] => ¿
[] => À
[] => Á
[] => Â
[] => Ã
[] => Ä
[] => Å
[] => Æ
[]
=> Ç
[] => È
[] => É
[] => Ê
[]
=> Ë
[] => Ì
[] => Í
[] => Î
[] =>
Ï
[] => Ð
[] => Ñ
[] => Ò
[] => Ó
[] => Ô
[] => Õ
[] => Ö
[] => ×
[]
=> Ø
[] => Ù
[] => Ú
[] => Û
[]
=> Ü
[] => Ý
[] => Þ
[] => ß
[] => à
[] => á
[] => â
[] => ã
[] => ä
[]
=> å
[] => æ
[] => ç
[] => è
[] =>
é
[] => ê
[] => ë
[] => ì
[] => í
[] => î
[] => ï
[] => ð
[] => ñ
[] =>
ò
[] => ó
[] => ô
[] => õ
[] => ö
[] => ÷
[] => ø
[] => ù
[] => ú
[] => û
[] => ü
[] => ý
[] => þ
[]
=> ÿ
[] => Œ
[] => œ
[] => Š
[] => š
[] => Ÿ
[] => ƒ
[] => ˆ
[] => ˜
[Α] =>
Α
[Β] => Β
[Γ] => Γ
[Δ] => Δ
[Ε] =>
Ε
[Ζ] => Ζ
[Η] => Η
[Θ] => Θ
[Ι] =>
Ι
[Κ] => Κ
[Λ] => Λ
[Μ] => Μ
[Ν] => Ν
[Ξ] => Ξ
[Ο] => Ο
[Π] => Π
[Ρ] => Ρ
[Σ] =>
Σ
[Τ] => Τ
[Υ] => Υ
[Φ] => Φ
[Χ] => Χ
[Ψ] => Ψ
[Ω] => Ω
[α] => α
[β] => β
[γ] =>
γ
[δ] => δ
[ε] => ε
[ζ] => ζ
[η] =>
η
[θ] => θ
[ι] => ι
[κ] => κ
[λ] =>
λ
[μ] => μ
[ν] => ν
[ξ] => ξ
[ο] => ο
[π] => π
[ρ] => ρ
[ς] => ς
[σ] => σ
[τ] =>
τ
[υ] => υ
[φ] => φ
[χ] => χ
[ψ] => ψ
[ω] => ω
[ϑ] => ϑ
[ϒ] => ϒ
[ϖ] => ϖ
[ ]
=>  
[ ] =>  
[ ] =>  
[] => ‌
[] => ‍
[] => ‎
[] => ‏
[] => –
[] => —
[] => ‘
[] => ’
[] => ‚
[] => “
[] => ”
[]
=> „
[] => †
[] => ‡
[] => •
[] =>
…
[] => ‰
[′] => ′
[″] => ″
[] => ‹
[] => ›
[‾] => ‾
[⁄] => ⁄
[] => €
[ℑ]
=> ℑ
[℘] => ℘
[ℜ] => ℜ
[] => ™
[ℵ] => ℵ
[←] => ←
[↑] => ↑
[→] => →
[↓] => ↓
[↔] => ↔
[↵] => ↵
[⇐] => ⇐
[⇑] => ⇑
[⇒] => ⇒
[⇓] =>
⇓
[⇔] => ⇔
[∀] => ∀
[∂] => ∂
[∃] =>
∃
[∅] => ∅
[∇] => ∇
[∈] => ∈
[∉] => ∉
[∋] => ∋
[∏] => ∏
[∑] => ∑
[−] => −
[∗] => ∗
[√] => √
[∝] => ∝
[∞] => ∞
[∠] => ∠
[∧] =>
∧
[∨] => ∨
[∩] => ∩
[∪] => ∪
[∫] => ∫
[∴]
=> ∴
[∼] => ∼
[≅] => ≅
[≈] => ≈
[≠] =>
≠
[≡] => ≡
[≤] => ≤
[≥] => ≥
[⊂] => ⊂
[⊃]
=> ⊃
[⊄] => ⊄
[⊆] => ⊆
[⊇] => ⊇
[⊕] => ⊕
[⊗] => ⊗
[⊥] => ⊥
[⋅] => ⋅
[⌈] => ⌈
[⌉]
=> ⌉
[⌊] => ⌊
[⌋] => ⌋
[〈] => ⟨
[〉] =>
⟩
[◊] => ◊
[♠] => ♠
[♣] => ♣
[♥] =>
♥
[♦] => ♦
)
<PHP String Reference