PHP

ความรู้พื้นฐานภาษา PHP

ตัวแปร ( variable )
ค่าคงที่
operator ( โอเปอเรเตอร์ )
คำสั่งเงื่อนไข (Conditional Statements)
คำสั่ง switch
คำสั่งการวนลูป
คำสั่ง break
คำสั่ง continue

type
  1. การกำหนดชนิด type ด้วยฟังก์ชัน settype()
  2. รู้ type ของตัวแปรด้วยฟังก์ชัน gettype()
  3. ฟังก์ชัน is_string()
  4. ฟังก์ชัน is_array()
  5. ฟังก์ชัน is_bool()
  6. ฟังก์ชัน is_float()
  7. ฟังก์ชัน is_double()
  8. ฟังก์ชัน is_real()
  9. ฟังก์ชัน is_int()
  10. ฟังก์ชัน is_integer()
  11. ฟังก์ชัน is_long()
  12. ฟังก์ชัน is_null()
  13. ฟังก์ชัน is_numeric()
  14. ฟังก์ชัน is_object()
  15. ฟังก์ชัน is_scalar()


number and math (ตัวเลขและคณิตศาสตร์)

ฟังก์ชัน is_numeric()
ฟังก์ชัน min()
ฟังก์ชัน max()
ฟังก์ชัน ceil()
ฟังก์ชัน floor()
ฟังก์ชัน round()
ฟังก์ชัน abs()
ฟังก์ชัน log()
ฟังก์ชัน log10()
ฟังก์ชัน decbin()
ฟังก์ชัน decoct()
ฟังก์ชัน dechex()
ฟังก์ชัน bindec()
ฟังก์ชัน octdec()
ฟังก์ชัน hexdec()
ฟังก์ชัน base_convert()
ฟังก์ชัน deg2rad()
ฟังก์ชัน rad2deg()
ฟังก์ชัน pi()
Predefined Constants (ค่าคงที่) ที่น่าสนใจเกี่ยวกับคณิตศาสตร์
ฟังก์ชัน sin()
ฟังก์ชัน cos()
ฟังก์ชัน tan()
ฟังก์ชัน fmod()

bc math ฟังก์ชันสำหรับคณิตศาสตร์ที่ต้องการการกำหนดความแม่นยำ
  1. ฟังก์ชัน bcadd()
  2. ฟังก์ชัน bcsub()
  3. ฟังก์ชัน bcmul()
  4. ฟังก์ชัน bcdiv()
  5. ฟังก์ชัน bcmod()
  6. ฟังก์ชัน bccomp()
  7. ฟังก์ชัน bcpow()
  8. ฟังก์ชัน bcsqrt()
  9. ฟังก์ชัน bcpowmod()
  10. ฟังก์ชัน bcscale()

การสุ่มตัวเลข
  1. ฟังก์ชัน rand()
  2. ฟังก์ชัน srand()
  3. ฟังก์ชัน getrandmax()
  4. ฟังก์ชัน mt_rand()
  5. ฟังก์ชัน mt_srand()
  6. ฟังก์ชัน mt_getrandmax()


array

รูปแบบของ array
การสร้าง array
การสร้าง array โดยการกำหนดค่าเริ่มต้น
การสร้าง array ซ้อน array
ฟังก์ชัน array_change_key_case()
ฟังก์ชัน array_pad()
ฟังก์ชัน array_pad() ด้วย parameter ลบ
ฟังก์ชัน array_splice()
ฟังก์ชัน array_merge()
ฟังก์ชัน each()
ฟังก์ชัน current()
ฟังก์ชัน pos()
ฟังก์ชัน key()
ฟังก์ชัน next()
ฟังก์ชัน prev()
ฟังก์ชัน end()
ใช้ array และฟังก์ชัน list()
ฟังก์ชัน array_reverse()
กำหนดให้ index ของ array ขึ้นต้นด้วย 1
ฟังก์ชัน unset()
ฟังก์ชัน array_pop()
ฟังก์ชัน array_push()
ฟังก์ชัน array_shift()
ฟังก์ชัน array_values()
ฟังก์ชัน array_keys()
ฟังก์ชัน array_chunk()
ฟังก์ชัน array_unshift()
ฟังก์ชัน array_unique()
ฟังก์ชัน array_count_values()
ฟังก์ชัน range()
ฟังก์ชัน sizeof()
ฟังก์ชัน count()
ฟังก์ชัน array_combine()
ฟังก์ชัน array_fill()
ฟังก์ชัน array_fill_keys()
ฟังก์ชัน array_flip()
ฟังก์ชัน array_intersect()
ฟังก์ชัน array_intersect_assoc()
ฟังก์ชัน array_intersect_key()
ฟังก์ชัน array_diff()
ฟังก์ชัน array_diff_assoc()
ฟังก์ชัน array_diff_key()
ฟังก์ชัน array_walk()
ฟังก์ชัน array_walk_recursive()

กลับด้านบน


string

ฟังก์ชัน addcslashes()
ฟังก์ชัน addslashes()
ฟังก์ชัน bin2hex()
ฟังก์ชัน chop()
ฟังก์ชัน chr()
ฟังก์ชัน chunk_split()
ฟังก์ชัน convert_uuencode()
ฟังก์ชัน convert_uudecode()
ฟังก์ชัน count_chars()
ฟังก์ชัน crc32()
ฟังก์ชัน crypt()
ฟังก์ชัน explode()
ฟังก์ชัน echo()
ฟังก์ชัน fprintf()
ฟังก์ชัน get_html_translation_table()
ฟังก์ชัน html_entity_decode()
ฟังก์ชัน htmlentities()
ฟังก์ชัน htmlspecialchars_decode()
ฟังก์ชัน htmlspecialchars()
ฟังก์ชัน implode()
ฟังก์ชัน join()
ฟังก์ชัน metaphone()
ฟังก์ชัน ltrim()
ฟังก์ชัน rtrim()
ฟังก์ชัน trim()
ฟังก์ชัน ord()
ฟังก์ชัน parse_str()
ฟังก์ชัน print()
ฟังก์ชัน printf()
ฟังก์ชัน quotemeta()
ฟังก์ชัน sha1()
ฟังก์ชัน sha1_file()
ฟังก์ชัน levenshtein()
ฟังก์ชัน md5()
ฟังก์ชัน md5_file()
ฟังก์ชัน similar_text()
ฟังก์ชัน soundex()
ฟังก์ชัน sprintf()
ฟังก์ชัน sscanf()
ฟังก์ชัน str_replace()
ฟังก์ชัน str_ireplace()
ฟังก์ชัน str_pad()
ฟังก์ชัน str_repeat()
ฟังก์ชัน str_rot13()
ฟังก์ชัน str_shuffle()
ฟังก์ชัน str_split()
ฟังก์ชัน str_word_count()
ฟังก์ชัน strcasecmp()
ฟังก์ชัน strchr()
ฟังก์ชัน stristr()
ฟังก์ชัน strcoll()
ฟังก์ชัน strcspn()
ฟังก์ชัน strip_tags()
ฟังก์ชัน stripcslashes()
ฟังก์ชัน stripslashes()
ฟังก์ชัน strlen()
ฟังก์ชัน strnatcasecmp()
ฟังก์ชัน strnatcmp()
ฟังก์ชัน strncasecmp()
ฟังก์ชัน strncmp()
ฟังก์ชัน strpbrk()
ฟังก์ชัน strrchr()
ฟังก์ชัน stripos()
ฟังก์ชัน strpos()
ฟังก์ชัน strripos()
ฟังก์ชัน strrpos()
ฟังก์ชัน strrev()
ฟังก์ชัน strspn()
ฟังก์ชัน strstr()
ฟังก์ชัน strtok()
ฟังก์ชัน strtolower()
ฟังก์ชัน strtoupper()
ฟังก์ชัน strtr()
ฟังก์ชัน substr()
ฟังก์ชัน substr_compare()
ฟังก์ชัน substr_count()
ฟังก์ชัน substr_replace()
ฟังก์ชัน ucfirst()
ฟังก์ชัน ucwords()
ฟังก์ชัน vfprintf()
ฟังก์ชัน vprintf()
ฟังก์ชัน vsprintf()
ฟังก์ชัน wordwrap()

กลับด้านบน


Function

การส่งค่า parameter โดยไม่ประกาศไว้ในฟังก์ชัน
การรู้จำนวน parameter ด้วยฟังก์ชัน func_num_args()
การรับค่า parameter โดยฟังก์ชัน func_get_arg()
การรับค่า parameter โดยฟังก์ชัน func_get_args()

กลับด้านบน


วัน เวลา ( date time )

ฟังก์ชัน time()
ฟังก์ชัน mktime()
ฟังก์ชัน date()
พารามิเตอร์ บางตัวที่สำคัญของ ฟังก์ชัน date()
ฟังก์ชัน strtotime()
รูปแบบ string ที่น่าสนใจสำหรับฟังก์ชัน strtotime()
ฟังก์ชัน getdate()
ฟังก์ชัน localtime()
ฟังก์ชัน strftime()
พารามิเตอร์ บางตัวที่สำคัญของ ฟังก์ชัน strftime()
ฟังก์ชัน gregoriantojd()
การใช้ฟังก์ชัน gregoriantojd() เพื่อคำนวณความต่างระยะห่างระหว่าง 2 วัน

คลาส DateTime

  1. คลาส DateTime
  2. การใช้ DateTime::diff
  3. การใช้ DateTime::add
  4. การใช้ DateTime::sub
  5. การใช้ DateTime::format
  6. การใช้ DateTime::getTimestamp
  7. การใช้ DateTime::setDate
  8. การใช้ DateTime::getTimezone
  9. การใช้ DateTime::modify
การใช้งานคลาส DateTime แบบฟังก์ชัน (Procedural style)
  1. ฟังก์ชัน date_create()
  2. ฟังก์ชัน date_diff()
  3. ฟังก์ชัน date_add()
  4. ฟังก์ชัน date_sub()
  5. ฟังก์ชัน date_format()
  6. ฟังก์ชัน date_timestamp_get()
คลาส DateInterval
  1. คลาส DateInterval
  2. พารามิเตอร์บางตัวที่สำคัญของ DateInterval::format

ฟังก์ชัน date_default_timezone_set()


กลับด้านบน


ฐานข้อมูล (Database)

table ที่ใช้เป็นตัวอย่างการติดต่อฐานข้อมูล

MySQL Functions
  1. connect ฐานข้อมูล ด้วย mysql_connect()
  2. เลือกฐานข้อมูล ด้วย mysql_select_db()
  3. query ฐานข้อมูล ด้วย mysql_query()
  4. query ฐานข้อมูล ด้วย mysql_db_query()
  5. แก้ไข เพิ่มเติม ลบ ข้อมูลในฐานข้อมูลด้วย mysql_query()
PDO (PHP Data Objects)
  1. ปรับ php.ini ให้ใช้งาน PDO ได้
  2. connect ฐานข้อมูล
  3. query ฐานข้อมูล
  4. แก้ไข เพิ่มเติม ลบ ข้อมูลในฐานข้อมูล

กลับด้านบน


Network

การหาชื่อและหมายเลขของ โปรโตคอล
  1. ฟังก์ชัน getprotobyname()
  2. ฟังก์ชัน getprotobynumber()
การหาชื่อ service และหมายเลขของ port
  1. ฟังก์ชัน getservbyname()
  2. ฟังก์ชัน getservbyport()
Dns
  1. ฟังก์ชัน gethostbyname()
  2. ฟังก์ชัน gethostbynamel()
  3. ฟังก์ชัน gethostbyaddr()
Socket Function
  1. สร้าง socket resource ด้วยฟังก์ชัน socket_create()
  2. ติดต่อ server ด้วยฟังก์ชัน socket_connect()
  3. ส่งข้อมูล ด้วยฟังก์ชัน socket_send()
  4. รับข้อมูล ด้วยฟังก์ชัน socket_recv()
curl
  1. curl คืออะไร
  2. ฟังก์ชัน curl_init()
  3. ฟังก์ชัน curl_setopt()
  4. พารามิเตอร์ของฟังก์ชัน curl_setopt()
  5. ฟังก์ชัน curl_exec()
  6. ฟังก์ชัน curl_close()

กลับด้านบน


คลาส

หลักการคร่าวๆ oop (Object oriented programming การเขียนโปรแกรบเชิงวัตถุ)
การประกาศ class
การสร้าง object
การควบคุมการเข้าถึง property และ ฟังก์ชันของคลาส
การอ้างอิง properties
การอ้างอิง properties ภายในคลาส
การเรียก method ทำงาน
การสืบทอดคลาส
การสร้าง interface
การสร้าง abstract class
การสร้าง constructor ของ class
การสร้าง destructor ของ class
การทำให้ object ส่งค่า string ออกมา

กลับด้านบน


command line

การใช้งาน php บน command line
การหา version ของ php
command line option ที่น่าสนใจ
การนับจำนวน argument ที่มาจาก command line
การอ่านค่าของ argument ด้วย $argv

กลับด้านบน


PEAR ( PHP Extension and Application Repository )

PEAR คืออะไร
การติดตั้ง PEAR
การแสดงรายการ PEAR package ที่ติดตั้งแล้ว
การหา PEAR package ที่สามารถติดตั้งได้
การติดตั้ง package
ยกเลิกการติดตั้ง package
แสดงรายการที่สามารถ upgrade ได้ของ package ที่ติดตั้งไปแล้ว
upgrade package ที่ติดตั้งไปแล้ว
command ของคำสั่ง pear ที่น่าสนใจ

กลับด้านบน


XML ( Extensible Markup Language )

ไฟล์ xml ที่ใช้เป็นตัวอย่าง
การอ่านข้อความจากไฟล์ xml ด้วยฟังก์ชัน simplexml_load_file()
การอ่านข้อมูลของ element ที่ต้องการด้วย xpath()

DOMDocument
  1. เริ่มต้นใช้งานคลาส DOMDocument
  2. สร้าง element ของ xml ด้วย DOMDocument::createElement()
  3. สร้าง text ด้วย DOMDocument::createTextNode()
  4. สร้าง string จากโครงสร้างไฟล์ xml ด้วย DOMDocument::saveXML()
  5. สร้างไฟล์ xml ด้วย DOMDocument::save()
  6. load xml จาก string ด้วย DOMDocument::loadXML()
  7. load xml จากไฟล์ด้วย DOMDocument::load()
  8. การอ่านข้อความจากไฟล์ xml ด้วย DOMDocument::getElementsByTagName()
  9. การใช้ xpath ร่วมกับ DOMDocument

กลับด้านบน


File

ทดสอบไฟล์
  1. ฟังก์ชัน is_file()
  2. ฟังก์ชัน is_link()
  3. ฟังก์ชัน is_executable()
  4. ฟังก์ชัน is_dir()
  5. ฟังก์ชัน is_readable()
  6. ฟังก์ชัน file_exists()

ข้อมูลเกี่ยวกับไฟล์
  1. ฟังก์ชัน filetype()
  2. ฟังก์ชัน filesize()
  3. ฟังก์ชัน filemtime()
  4. ฟังก์ชัน lstat()
  5. ฟังก์ชัน stat()
  6. ฟังก์ชัน basename()
  7. ฟังก์ชัน dirname()
  8. ฟังก์ชัน realpath()
  9. ฟังก์ชัน pathinfo()
  10. ฟังก์ชัน filegroup()
  11. ฟังก์ชัน fileowner()
  12. ฟังก์ชัน fileperms()

ดำเนินการเกี่ยวกับไฟล์
  1. ฟังก์ชัน fopen()
  2. ฟังก์ชัน fread()
  3. ฟังก์ชัน fgets()
  4. ฟังก์ชัน fgetc()
  5. ฟังก์ชัน file()
  6. ฟังก์ชัน file_get_contents()
  7. ฟังก์ชัน fwrite()
  8. ฟังก์ชัน fputs()
  9. ฟังก์ชัน file_put_contents()
  10. ฟังก์ชัน flock()
  11. ฟังก์ชัน ftruncate()
  12. ฟังก์ชัน fseek()
  13. ฟังก์ชัน ftell()
  14. ฟังก์ชัน rewind()
  15. ฟังก์ชัน rename()
  16. ฟังก์ชัน glob()
  17. ฟังก์ชัน fstat()
  18. ฟังก์ชัน fclose()
  19. ฟังก์ชัน feof()
  20. ฟังก์ชัน tempnam()
  21. ฟังก์ชัน tmpfile()
  22. ฟังก์ชัน copy()
  23. ฟังก์ชัน unlink()
  24. ฟังก์ชัน symlink()
  25. ฟังก์ชัน mkdir()
  26. ฟังก์ชัน rmdir()
  27. ฟังก์ชัน chmod()
  28. ฟังก์ชัน chgrp()
  29. ฟังก์ชัน chown()
  30. ฟังก์ชัน clearstatcache()
  31. ฟังก์ชัน parse_ini_file()

อื่นๆ เกี่ยวกับไฟล์
  1. ฟังก์ชัน disk_free_space()
  2. ฟังก์ชัน diskfreespace()
  3. ฟังก์ชัน disk_total_space()

กลับด้านบน


Configuration ( การตั้งค่า )

directive ที่น่าสนใจใน php.ini
ตั้งค่า option ด้วยฟังก์ชัน ini_set()
ตั้งค่า option ด้วยฟังก์ชัน ini_alter()
รับค่า option ด้วยฟังก์ชัน ini_get()
รับค่า configuration option ทั้งหมดด้วยฟังก์ชัน ini_get_all()
ตั้งค่า configuration option กลับไปเป็นค่าเริ่มต้นด้วยฟังก์ชัน ini_restore()
จำกัดเวลาการ run script ด้วยฟังก์ชัน set_time_limit()
รับค่า configuration option ด้วยฟังก์ชัน get_cfg_var()

ตัวแปร
  1. การอ่านค่า constants
  2. การอ่านค่าตัวแปร environment variable
path
  1. การกำหนด include_path
  2. การอ่านค่า include_path
  3. ตั้งค่า include_path กลับไปเป็นเหมือนเดิมด้วยฟังก์ชัน restore_include_path()
extension
  1. การอ่านค่า modules ที่ถูก compile และถูก load
  2. การทดสอบว่า extension ถูก load หรือไม่
  3. การเรียกดูว่า module มีฟังก์ชันอะไรบ้าง
  4. การ load extension ด้วยฟังก์ชัน dl()
เกี่ยวกับ php
  1. print credit ของ php ด้วยฟังก์ชัน phpcredits()
  2. print ข้อมูลของ php ด้วยฟังก์ชัน phpinfo()
  3. แสดง version ของ php ด้วยฟังก์ชัน phpversion()
  4. รับค่าเกี่ยวกับ operating system ด้วยฟังก์ชัน php_uname()

กลับด้านบน


zip

ฟังก์ชัน zip_open()
ฟังก์ชัน zip_read()
ฟังก์ชัน zip_close()
ฟังก์ชัน zip_entry_open()
ฟังก์ชัน zip_entry_read()
ฟังก์ชัน zip_entry_close()
ฟังก์ชัน zip_entry_name()
ฟังก์ชัน zip_entry_filesize()
ฟังก์ชัน zip_entry_compressedsize()
ฟังก์ชัน zip_entry_compressionmethod()

กลับด้านบน


FTP

ฟังก์ชัน ftp_connect()
ฟังก์ชัน ftp_login()
ฟังก์ชัน ftp_close()
ฟังก์ชัน ftp_quit()
ฟังก์ชัน ftp_alloc()
ฟังก์ชัน ftp_cdup()
ฟังก์ชัน ftp_chdir()
ฟังก์ชัน ftp_chmod()
ฟังก์ชัน ftp_delete()
ฟังก์ชัน ftp_fget()
ฟังก์ชัน ftp_fput()
ฟังก์ชัน ftp_get()

กลับด้านบน


เรื่องอื่นๆ

เปรียบเทียบ == กับ ===
การประกาศตัวแปรแบบ global
output Buffer
การแสดงข้อความทีละส่วน
ฟังก์ชัน print_r
ฟังก์ชัน var_dump
ฟังก์ชัน in_array
ฟังก์ชัน array_key_exists
uniqid
intval
floatval
หา directory ปัจจุบัน ด้วยฟังก์ชัน getcwd()
สร้าง constant ด้วยฟังก์ชัน define()
ทดสอบว่ามี constant อยู่หรือไม่ ด้วยฟังก์ชัน defined()
ประมวลผลสตริงให้เป็น php code ด้วยฟังก์ชัน eval()
ค้นหาความสามารถของ browser จากไฟล์ browscap.ini ด้วยฟังก์ชัน get_browser()
แสดงข้อมูลของไฟล์ และ highlight PHP syntax ด้วยฟังก์ชัน highlight_file()
แสดงข้อมูลของไฟล์ และ highlight PHP syntax ด้วยฟังก์ชัน show_source()
ทดสอบสถานะของการ connection ด้วยฟังก์ชัน connection_status()
เช็คว่าผู้ใช้ยกเลิกการติดต่อหรือไม่ ด้วยฟังก์ชัน connection_aborted()
หยุดการทำงานของ script ด้วยฟังก์ชัน exit()
แสดงข้อความและหยุดการทำงานของ script ด้วยฟังก์ชัน die()
delay การทำงาน ด้วยฟังก์ชัน sleep()
delay การทำงาน ด้วยฟังก์ชัน usleep()
delay การทำงาน ด้วยฟังก์ชัน time_nanosleep()
delay การทำงาน ด้วยฟังก์ชัน time_sleep_until()
packs data ใส่ binary string ด้วยฟังก์ชัน pack()
unpacks data จาก binary string ด้วยฟังก์ชัน unpack()
ตั้งค่าว่า script จะ run ต่อหรือไม่ถ้า user disconnect ด้วยฟังก์ชัน ignore_user_abort()
ส่ง header ของ http ด้วยฟังก์ชัน header()
อ่านค่า header ของ http ด้วยฟังก์ชัน headers_list()
เช็คว่าส่ง header แล้วหรือยัง ด้วยฟังก์ชัน headers_sent()

กลับด้านบน


กลับ menu หลัก