• LINE ID: @CARRENT
  • [email protected]
VoucherCar
  • หน้าแรก
  • สินค้า
    • แยกจังหวัดรถเช่า
    • แยกตามระดับเครื่องยนต์
    • แยกตามราคารถเช่า
    • แยกตามยี่ห้อรถเช่า

    • ตะกร้าสินค้า
    • จองด่วนน้อยกว่า 7 วัน
    • รถเช่า รายสัปดาห์
  • บทความเนื้อหา
    • คำถามพบบ่อย
    • บทความรถเช่า
    • สาขารถเช่า
    • WEBBOARD
  • วิธีการสั่งซื้อ
    • วิธีการสั่งซื้อ
    • รายละเอียดการชำระเงิน
  • จองด่วน
  • ติดต่อเรา
เข้าสู่ระบบ
รถเช่าราคาประหยัดadver
รถเช่า ประเภทต่างๆ

แยกตามจังหวัด แยกตามเครื่องยนต์ แยกตามราคา แยกตามยี่ห้อ รถเช่า รายสัปดาห์

คำถามพบบ่อยเกียวกับรถเช่า ข่าวสารบทความรถเช่า สาขาบริษัทรถเช่า เว็บบอร์ด (Webboard)

วิธีสั่งซื้อ รายละเอียดการชำระเงิน
ติดต่อเรา
รถเช่า จังหวัด

---
กลับไปหน้าเว็บบอร์ด

Deprecated features in PHP 5.3.x

ผู้ตั้งกระทู้: a
วันที่: 10/09/2012 เวลา: 10:56:04

PHP 5.3 เปลี่ยนอะไรบ้าง (php version 5.3.x)

สวัสดีครับ ช่วงนี้ต้องรวบรวมข้อมูลสำหรับทำงาน เลยถือโอกาสเขียนเป็นบทความเอาไว้ให้หลายๆท่านได้อ่านกัน ที่จริงแล้วส่วนนี้มีคนเขียนไว้ค่อนข้างจะเยอะครับ ลอง search ดูก็น่าจะเจอเยอะอยู่เหมือนกันครับ และคำอธิบายก็จะไกล้ๆเคียงกัน เพราะที่มาก็มาจาก php.net เหมือนกันเกือบทั้งหมดครับ บางที่ก็ไป copy เขามาต่อๆกันไป สำหรับบทความใน siammodify นี้หากผู้ใด copy ไปช่วยติดลิ้งค์กลับด้วยนะครับ

php function บางตัวที่จะถูกตัดออกไปใน php version 5.3

  • call_user_method()
  • call_user_method_array()
  • defin_syslog_variables()
  • dl()
  • ereg()
  • ereg_replace()
  • eregi()
  • eregi_replace()
  • set_magic_quotes_runtime()
  • session_register()
  • session_unregister()
  • session_is_register()
  • set_socket_blocking()
  • split()
  • spliti()
  • sql_regcase()
  • mysql_db_query()
  • mysql_escape_string()

ตัวอย่าง
erigi() become => preg_match(‘/theregex/i’) or => preg_match(‘#theregex#i’)
ereg_replace become => preg_replace(‘/theregex/’) or => preg_replace(‘#theregex#’)

function ที่ถูกตัดออกไปผมว่าน่าจะส่งผลกระทบต่อโปรแกรมหลายๆโปรแกรมครับเนื่องด้วยบาง function ค่อนข้างเป็นที่นิยมตรงส่วนนี้ก็คงต้องไล่ๆปรับกันแหละครับ เช่นพวก ereg ต่างๆและ split รวมไปถึง mysql_db_query ที่เวลาผมแกะโปรแกรมบางตัวก็มักจะเจออยู่บ่อยๆครับ

และสำหรับเรื่องคุณสมบัติจะมีการยกเลิกบางอย่าง ซึ่งคุณสมบัติที่ถูกยกเลิก คือ
- การส่งค่าแบบ reference ( Assigning the return value of new by reference is now deprecated. )
- Call-time pass-by-reference is now deprecated.

สำหรับ function Deprecated features in PHP 5.3.x สามารถอ่านเพิ่มเติมได้ที่นี่นะครับ
http://th.php.net/manual/en/migration53.deprecated.php


นอกจากจะตัด function บางตัวออกไปแล้วสำหรับบาง function ก็มีการเพิ่ม Parameters เข้ามาดังนั้นเราอาจจะจำเป็นต้องไปใส่ Parameters ให้กับ function เหล่านั้นให้ถูกต้องตามด้วยครับ

รายชื่อตัวอย่าง function ที่มีการเพิ่ม Parameters เข้ามา

  • clearstatcache() – Added clear_realpath_cache and filename.
  • copy() - Added a stream context parameter, context.
  • fgetcsv() – Added escape.
  • ini_get_all() – Added details.
  • nl2br() – Added is_xhtml.
  • parse_ini_file() – Added scanner_mode.
  • round() - Added mode.
  • stream_context_create() – Added params.
  • strstr() and stristr() – Added before_needle.

function ที่มีการเพิ่ม Parameters เข้ามาหรือมีการปรับเปลี่ยนสามารถดูเพิ่มเติมได้จากลิ้งค์นี้ครับ
http://th.php.net/manual/en/migration53.parameters.php


Seagull Framework
ผมขอเอ่ยถึงตัว seagull framework สักนิดนะครับ สำหรับ seagull framework ใน version เก่าๆจะมีเรียกใช้ function พวก call_user บางตัวครับ ในส่วนนี้เท่าที่หาดูมีการแจ้งออกมา และทางทีมงาน เขาก็ได้ทำการ fix bug ไปเรียบร้อยแล้ว ปัญหาจะเจอประมาณ
SectionMgr, NavigationDAO::addSection และ NavigationDAO::updateSection

โดยทำการปรับเปลี่นเป็น
return call_user_func_array(array($delegate, $methodName),$parameters);
สำหรับ seagull หากมีข้อผิดพลาดประการใดก็ต้องขออภัยด้วยนะครับ


และในส่วนของ php.ini ก็จะมีการยกเลิกบางอย่างออกไปครับ ตัวใหนผมอธิบายได้จะช่วยอธิบายคร่าวๆไว้ให้นะครับ

  • register_globals แปลว่าการเขียนรับค่าตัวแปรจะต้องเปลี่ยนไปใช้ ( $_REQUEST, $_GET, $_POST, $_SESSION, $_SERVER ) เท่านั้นครับ
  • define_syslog_variables
  • register_long_arrays
  • safe_mode
  • magic_quotes_gpc
  • magic_quotes_runtime
  • magic_quotes_sysbase

สำหรับเรื่อง Changes to INI file handling สามารถอ่านเพิ่มเติมได้ที่นี้นะครับ
http://th.php.net/manual/en/migration53.ini.php


ขอนอกเรื่องอีกนิดนึงนะครับ
พอดีผมได้เจอหลายๆเว็บเขียนบทความเกี่ยวกับ PHP 5.3 หน้าตาเนื้อหาก็คล้ายๆกัน แต่ผมชอบจุดที่อธิบายสั้นๆแต่เข้าใจได้คือ

# ereg, eregi, ereg_replace, eregi_replace เปลี่ยนไปใช้ตระกูล perl compatible regular expressions (preg*)
# split เปลี่ยนไปใช้ preg_split แทน
# mysql_db_query เปลี่ยนไปใช้ mysql_select_db แล้วตามด้วย mysql_query
# mysql_escape_string เปลี่ยนไปใช้ mysql_real_escape_string
# register_globals เปลี่ยนไปใช้ Built-in global variables ($_REQUEST, $_GET, $_POST, $_SESSION, $_SERVER)
# session_register, session_is_register, session_unregister เปลี่ยนไปใช้ $_SESSION

เพียงแค่จุดนี้ก็ช่วยสรุปจุดสำคัญที่เราใช้กันบ่อยๆได้มากทีเดียวครับ


จากทั้งหมดนี้ท่านสามารถอ่านเพิ่มเติมได้ที่ลิ้งค์เหล่านี้นะครับ

What has changed in PHP 5.3.x

http://th.php.net/manual/en/migration53.changes.php

Backward Incompatible Changes in PHP 5.3.x

http://th.php.net/manual/en/migration53.incompatible.php

New features in PHP 5.3.x

http://th.php.net/manual/en/migration53.new-features.php

Changes made to Windows support in PHP 5.3.x

http://th.php.net/manual/en/migration53.windows.php

Changes in SAPI modules in PHP 5.3.x

http://th.php.net/manual/en/migration53.sapi.php

Undeprecated features in PHP 5.3.x

http://th.php.net/manual/en/migration53.undeprecated.php


New Functions in PHP 5.3.x

  • array_replace() – Replaces elements from passed arrays into one array.
  • array_replace_recursive() – Recursively replaces elements from passed arrays into one array.
  • class_alias() – Creates an alias for a user defined class.
  • forward_static_call() – Call a user function from a method context.
  • forward_static_call_array() – Call a user function from a method context, with the arguments contained in an array.
  • gc_collect_cycles() – Forces collection of any existing garbage cycles.
  • gc_disable() – Deactivates the circular reference collector.
  • gc_enable() – Activates the circular reference collector.
  • gc_enabled() – Returns the status of the circular reference collector.
  • get_called_class() – Return the name of the class a static method is called in.
  • gethostname() – Return the current host name for the local machine.
  • header_remove() – Removes an HTTP header previously set using the header() function.
  • lcfirst() – Make a string’s first character lowercase.
  • parse_ini_string() – Parse a configuration string.
  • quoted_printable_encode() – Convert an 8 bit string to a quoted-printable string.

New Functions in PHP 5.3.x
http://th.php.net/manual/en/migration53.functions.php


New stream wrappers in PHP 5.3.x

http://th.php.net/manual/en/migration53.new-stream-wrappers.php

New stream filters in PHP 5.3.x

http://th.php.net/manual/en/migration53.new-stream-filters.php

New Class Constants in PHP 5.3.x

http://th.php.net/manual/en/migration53.class-constants.php

New Methods in PHP 5.3.x

http://th.php.net/manual/en/migration53.methods.php

New Extensions in PHP 5.3.x

http://th.php.net/manual/en/migration53.new-extensions.php

Removed Extensions in PHP 5.3.x

http://th.php.net/manual/en/migration53.removed-extensions.php

Other changes to extensions in PHP 5.3.x

http://th.php.net/manual/en/migration53.extensions-other.php

New Classes in PHP 5.3.x

http://th.php.net/manual/en/migration53.classes.php

New Global Constants in PHP 5.3.x

http://th.php.net/manual/en/migration53.global-constants.php

Other changes in PHP 5.3.x

http://th.php.net/manual/en/migration53.other.php

ผมหวังว่าบทความน่าจะเป็นประโยชน์แก่ใครหลายๆคนนะครับ และ หากท่านใดเอาทบความที่ผมเขียนนี้ไปใช้งาน ช่วยกรุณาใส่ลิ้งค์กลับมายังเว็บผมด้วยนะครับ และหากมีจุดใหนที่ผิดหรือเพี้ยนไปก็ต้องขออภัยด้วยนะครับ และแจ้งมาได้ครับทางผมจะได้แก้ไขให้ถูกต้อง ขอบคุณครับ


http://www.siammodify.com/%E0%B9%80%E0%B8%9B%E0%B8%A5%E0%B8%B5%E0%B9%88%E0%B8%A2%E0%B8%99%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3%E0%B8%9A%E0%B9%89%E0%B8%B2%E0%B8%87%E0%B9%83%E0%B8%99-php-5-3-%E0%B8%84%E0%B8%B7%E0%B8%AD.html

ความคิดเห็นทั้งหมด
a
10/09/2012 | 10:56:34
php 5.3 ออกมานาน พอสมควรแล้ว แต่ Hosting ส่วนใหญ่ยังเป็น 5.2 ??? มาดูกันครับ
เนื่องจาก php 5.3 ได้มีการยกเลิก Function ที่ใช้กัน หลาย function ถูกยกเลิก, การตั้งค่า ใน INI, ยกเลิก Extensions หลายอย่าง
มาดู Function ที่ถูกใช้งานบ่อยๆ แล้วถูกยกเลิกไป (ผมยกตัวอย่าง เพื่อให้เห็น ความเดือดร้อนถ้าคิดจะอัพ php เป็น 5.3 )
เฉพาะเรื่อง Session , กับ function regular expression ก็ทำให้โปรแกรเมอร์ PHP ป่วนกันได้เยอะทีเดียว เลยครับ สำหรับคนที่ไม่ได้เขียนโค้ดไว้สำหรับ php 5.3 ยกตัวอย่างเช่น Function
- session_register() สำหรับ php 4.3 คนที่จะใช้ งาน session มักจะคุ้นกับ ฟังก์ชั่นี้ แต่ ถ้าอัพมา 5.3 session_register เค้าแนะนำให้ใช้ $_SESSION ซึ่งเป็นการใช้งาน session ผ่าน ตัวแปล superglobal แทน จะเห็นว่าทำให้สามารถทำงานได้สะดวกขึ้น

- Function ในตระกูล ereg ทั้งหลาย งานนี้ยุ่งหน่อยครับ เพราะ การเช็คข้อความเปรียบเทียบ String ค้นหา String เรามักจะใช้ ereg เค้าก็แนะนำให้หันไปใช้ preg แทน แต่แต่ละ function ไม่ใช่ว่า เปลี่ยนชื่อแล้วจะใช้ได้นะครับ มันไม่ตรงไปตรงมาขนาดนั้น

- Function ที่เกี่ยวกับ mysql เช่น mysql_db_query สำหรับคนที่ชอบเขียน แบบทางลัดคือ รันคำสั่ง SQL โดย เลือก ฐานข้อูลไปในตัว ก็ต้องเปลี่ยน มา ใช้ ฟังก์ชั่น เลือกฐานข้อมูลก่อน แล้วค่อย รันคำสั่ง sql
อีกฟังก์ชั่นที่หนักอก อีกอย่างคือ mysql_escape_string ต้องเปลี่ยนมาใช้ mysql_real_escape_string แทน

นอกจากนี้ แล้ว การที่ php 5.3 ยกเลิก Extensions บางตัวไป ทำให้ กลุ่มของ function นั้นๆหลายไปทั้งกลุ่ม

ศึกษาข้อมูลเพิ่มเติมที่ http://us.php.net/manual/en/migration53.deprecated.php

http://www.mindphp.com/%E0%B8%9A%E0%B8%97%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1/66-server-hosting/2237-web-server-hosting-php-5.3.html
ร่วมแสดงความคิดเห็น

Copyright © 2026 vouchercar.com

*** ไม่อนุญาตให้ลงโฆษณาขายสินค้าใดๆ ก่อนได้รับอนุญาตจากทางเว็บนะคะ ***