PHP HTML แปลงภาษาอังกฤษตัวพิมพ์เล็ก ตัวพิมพ์ใหญ่ text-transform หรือ strtoupper, strtolower, ucfirst, ucwords

PHP HTML แปลงภาษาอังกฤษตัวพิมพ์เล็ก ตัวพิมพ์ใหญ่ text-transform หรือ strtoupper, strtolower, ucfirst, ucwords

ทำเว็บภาษาอังกฤษ สำหรับแสดงตัวอักษรภาษาอังกฤษ กำหนดได้ 3 รูปแบบ
ตัวอักษรตัวพิมพ์เล็ก ตัวพิมพ์ใหญ่ โดยใช้ ฟังก์

สำหรับ css

div.a {
  text-transform: uppercase;
}

div.b {
  text-transform: lowercase;
}

div.c {
  text-transform: capitalize;
}

สำหรับฟังก์ชั่น PHP

<?php 
$texteng = 'Hello world';

echo strtoupper($texteng).'<br>';
echo strtolower($texteng).'<br>';
echo ucfirst($texteng).'<br>';
echo ucwords($texteng).'<br>';
echo mb_strtoupper($texteng).'<br>';

//	strtoupper();	พิมพ์ใหญ่ทั้งหมด คือ HELLO WORLD
//	strtolower();	พิมพ์เล็กทั้งหมด คือ hello world
//	ucfirst(); 		พิมพ์ใหญ่คำแรก คือ Hello world
//	ucwords(); 		พิมพ์ใหญ่ตัวแรงของทุกคำ คือ Hello World
//	mb_strtoupper(); พิมพ์ใหญ่ทั้งหมด คือ HELLO WORLD (Unicode)
?>

strtoupper() - Make a string uppercase
strtolower() - Make a string lowercase
ucfirst() - Make a string's first character uppercase
ucwords() - Uppercase the first character of each word in a string
mb_strtoupper() - Make a string uppercase