• Home
  • About
Rss feed Subscribe

ตัวอย่าง ฟังก์ชัน include() PHP

May.14, 2010 in PHP Leave a Comment

ฟังก์ชัน include() เป็นฟังก์ชันที่ใช้รวมไฟล์ภายนอกเข้ามาใช้ในโปรกแรมของเรา ซึ่งถ้าฟังก์ชัน include() หาไฟล์ไม่เจอจะขึ้น wornning แล้วทำงานต่อได้ ต่างกับ require ที่หยุดการทำงาน-ทำงานต่อ

รูปแบบ

<?
   include("file.php");
   // file.php = ไฟล์ที่เราต้องการดึงเข้ามาครับ
?>

อ่านต่อ »

Tags: PHP, PHP Function, ฟังก์ชัน PHP

ตัวอย่าง ฟังก์ชัน require() PHP

May.14, 2010 in PHP 1 Comment

ฟังก์ชัน require() เป็นฟังก์ชันที่ใช้ดึงหรือรวมไฟล์ หรือ เอกสารจากภายนอกมาใช้งานในส่วนของโปรแกรมของเรา ฟังก์ชัน require() จะทำงานเมื่อสามารถดึงเอกสารนั้นได้ แต่ถ้าไม่สามารถดึงเอกสารได้จะหยุดทำงานทันที

รูปแบบ

<?
   require("file.php");
   // file.php = ไฟล์ที่เราต้องการดึงเข้ามาครับ
?>

อ่านต่อ »

Tags: PHP, PHP Function, ฟังก์ชัน PHP

ตัวอย่าง ฟังก์ชัน strip_tags() PHP

May.14, 2010 in PHP Leave a Comment

ฟังก์ชัน strip_tags() เป็นฟังก์ชันที่ใช้ตัดเท็ก(tag) HTML, CSS, Javascript.. ออกให้เหลือแต่ข้อความ
ตัวอย่าง : <b>Hello</b> เมื่อใช้ฟังก์ชัน strip_tags() จะเหลือเพียงแต่ Hello

รูปแบบ

<?
  strip_tags("ข้อความ-code html");
?>

อ่านต่อ »

Tags: PHP, PHP Function, String PHP Function, ฟังก์ชัน PHP

ตัวอย่าง ฟังก์ชัน substr() PHP

May.14, 2010 in PHP Leave a Comment

ฟังก์ชัน substr() เป็นฟังก์ชันที่ใช้ตัดตัวอักษรออกจากข้อความตามตำแหน่งที่เราต้องการ

ตัวอย่าง : “Hello789″ ต้องการตัด ‘789′ ออกให้เหลือ “Hello” เป็นต้น

รูปแบบ

<?
    substr(ข้อความ,ตำแหน่งเริ่มต้น,ตำแหน่งสินสุด);
    // ข้อความ = ข้อความที่ต้องการตัด
    // ตำแหน่งเริ่มต้น = ค่าตำแหน่งจุดเริ่มต้นของการตัด
    // ตำแหน่งสิ้นสุด = จำนวนที่เลื่อนจากจุดเริ่มต้น
?>

อ่านต่อ »

Tags: PHP, PHP Function, ฟังก์ชัน PHP

ตัวอย่าง ฟังก์ชัน round() PHP

May.14, 2010 in PHP Leave a Comment

ฟังก์ชัน round() เป็นฟังก์ชันปัดเศษของทดศนิยม คือจะปัดขึ้นเมื่อจุดทดศนิยมมีค่า มากว่าหรือเท่ากับ (>=) .5 ขึ้นไป ถ้าน้อยกว่า .5 จะปัดลง เช่น 4.5 = 5 หรือ 5.6 = 6 เป็นต้น

หมายเหตุ : เราสามารถเลือกจำนวนจุดทดศนิยมที่จะแสดงได้ด้วย เช่น 1 ตำแหน่ง 2 ตำแหน่ง เป็นต้น

รูปแบบ

<?
   round(ตัวเลข, จำนวนทศนิยม);
?>

อ่านต่อ »

Tags: PHP, PHP Function, ฟังก์ชัน PHP

ตัวอย่าง ฟังก์ชัน strtoupper() PHP

May.10, 2010 in PHP Leave a Comment

ฟังก์ชัน strtoupper() เป็ันฟังก์ชันที่ใช้แปลงขอความจากตัวอักษรพิมพ์เล็กเป็นอักษรตัวพิมพ์ใหญ่ ตามชื่อฟังก์ชันเลยครับ string to uppercase

รูปแบบ

<?
   strtoupper("ข้อความ");
?>

อ่านต่อ »

Tags: PHP, PHP Function, String PHP Function, ฟังก์ชัน PHP

ตัวอย่าง ฟังก์ชัน strtolower() PHP

May.10, 2010 in PHP Leave a Comment

ฟังก์ชัน strtolower() เป็ันฟังก์ชันที่ใช้แปลงขอความจากตัวอักษรพิมพ์ใหญ่เป็นอักษรตัวพิมพ์เล็ก ตามชื่อฟังก์ชันเลยครับ string to lowercase

รูปแบบ

<?
   strtolower("ข้อความ");
?>

อ่านต่อ »

Tags: PHP, PHP Function, String PHP Function, ฟังก์ชัน PHP

ตัวอย่าง ฟังก์ชัน date() PHP

May.10, 2010 in PHP Leave a Comment

ฟังก์ชัน date() เป็นฟังก์ชันที่ใช้แสดงวันที่และเวลา ซึ่งเราสามารถกำหนดรูปแบบการแสดง date – time format ได้

รูปแบบ

<?
    date($format);
    // $format = รูปแบบของการแสดงผลวันที่และเวลา
?>

อ่านต่อ »

Tags: DATE TIME, PHP, PHP Function, ฟังก์ชัน PHP

ตัวอย่าง ฟังก์ชัน nl2br() PHP

May.10, 2010 in PHP Leave a Comment

ฟังก์ชัน nl2br() เป็นฟังก์ชันที่ใช้แทนการกด enter(ขึ้นบรรทัดใหม่ จะเป็นcode \n ) ด้วย tag html <br/>
ส่วนใหญ่จะใช้ในส่วนของ textarea

รูปแบบฟังก์ชัน

<?
    nl2br($string);
    // $string = รับค่ามาจาก textarea
?>

อ่านต่อ »

Tags: PHP, PHP Function, ฟังก์ชัีน PHP

ตัวอย่าง ฟังก์ชัน trim() PHP

May.09, 2010 in PHP Leave a Comment

ฟังก์ชัน trim() เป็นฟังก์ชันที่ใช้ตัดช่องว่าง หน้า – หลัง ของข้อความออก เช่น ” hello ” ตัดเป็น “hello”

รูปแบบ

<?
   trim(" ข้อความ ");
?>

อ่านต่อ »

Tags: PHP, PHP Function, String PHP Function, ฟังก์ชัน
« previous entries  
Next Page »
  • เวบเพื่อนบ้าน

    • Coding First ฟอรั่ม
    • TopsPhuket
    • ศูนย์รวม Tips ต่างๆ
    • สุขภาพ Healthy
  • Categories

    • PHP (20)
    • SMF (3)
    • SQL (5)
    • Uncategorized (1)
  • Tags

    CMS DATE TIME Google Translate API htaccess MOD SMF MySQL PHP PHP Function SMF SMF MOD SQL String PHP Function TIP SMF ฟังก์ชัน ฟังก์ชัน PHP ฟังก์ชัีน PHP
  • Recent Posts

    • ตัวอย่าง ฟังก์ชัน include() PHP
    • ตัวอย่าง ฟังก์ชัน require() PHP
    • ตัวอย่าง ฟังก์ชัน strip_tags() PHP
    • ตัวอย่าง ฟังก์ชัน substr() PHP
    • ตัวอย่าง ฟังก์ชัน round() PHP
    • ตัวอย่าง ฟังก์ชัน strtoupper() PHP
    • ตัวอย่าง ฟังก์ชัน strtolower() PHP
    • ตัวอย่าง ฟังก์ชัน date() PHP
    • ตัวอย่าง ฟังก์ชัน nl2br() PHP
    • ตัวอย่าง ฟังก์ชัน trim() PHP
  • Recent Comments

    • SHAWN on ตัวอย่าง ฟังก์ชัน require() PHP
    • admin on การติดตั้ง MOD Sitemap สำหรับ SMF
    • ท่องเที่ยว on การติดตั้ง MOD Sitemap สำหรับ SMF
    • boy on การใช้งาน Google Translate API สำหรับ php
    • dumdums on การใช้งาน Google Translate API สำหรับ php
  • Archives

    • May 2010
    • April 2010
    • March 2010
  • RSSTwitter@zagina

    zagina
    • ร้อนๆๆ 05:45:43 AM April 22, 2010 from web
    • Disallow: /*?page=0,0$ 09:50:29 AM April 11, 2010 from web
    • Drupal + SEO 07:43:41 AM April 11, 2010 from web
    • Drupal 07:43:26 AM April 11, 2010 from web
    • ร้อนๆ ร้อนๆ 07:43:17 AM April 11, 2010 from web
    • ..... 03:55:14 PM April 09, 2010 from web
    • ูู^^_ 01:37:24 PM March 31, 2010 from web
    • อากาศกำลังดี ^^ 01:21:58 PM March 31, 2010 from web
    • ง่่วงๆๆ 07:07:23 AM March 31, 2010 from web
    • http://www.google.com/insights/search/# 07:07:10 AM March 31, 2010 from web
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org

Coding First is proudly powered by WordPress and Siteslike

Full RSS - Comments RSS

The last Robot visite is Yandex (77.88.29.246) Today time 11.57