PHP common function object_php tutorial-PHP Tutorial

Source: Internet
Author: User
Common PHP function objects. Character processing function SQL statement reserved character escape longget_magic_quotes_gpc (void) stringaddslashes (stringstr) stringstripslashes (stringstr) character ASCI =========== character processing function ==============
Escape characters retained in SQL statements
Long get_magic_quotes_gpc (void)
String addslashes (string str)
String stripslashes (string str)
ASCII code of a character
Int ord (string) decimal
String chr (ascii) decimal octal (0) hexadecimal (0x)
String base_convert (string $ number, int $ frombase, int $ tobase)
Clear string spaces
String trim (string, charlist) charlist, optional
String rtrim (string, charlist)
String ltrim (string, charlist)
Change Case sensitivity
String strtolower (string $ str)
String strtoupper (string $ str)
String ucfirst (string $ str)
String ucwords (string $ str)
Truncate string
Array explode (separator, string, limit) limit (optional) maximum number of returned array elements
String substr (string, start, length)
Int strlen (string)
String strstr (string, search) case sensitive
String stristr (string, search)
String str_repeat (string, repeat)
String search
Int strpos (string, find, start) start, optional
Int substr_count (string, substring, start, length) start, length, optional
String str_replace (find, replace, string, count) count, optional.
String strrev (string $ string) character flip, limited to one byte character
Html processing
String htmlspecialchars (string, quotestyle, character-set) quotestyle, character-set, optional.
Htmlentities ("

I love you

", ENT_COMPAT," GB2312 ")
String htmlspecialchars_decode (string, quotestyle, character-set)
String htmlentities (string, quotestyle, character-set)
String html_entity_decode (string, quotestyle, character-set)
String strip_tags (string $ str [, string $ allowable_tags])
Date and time [Y-m-d H: I: s]

-----------------------------------

Set the time zone in php
1. generation part declaration
Date_default_timezone_set (PRC );
2. php. ini definition
Date. timezone = "PRC"

-----------------------------------
Double time (void)
Float microtime (get_as_float) get_as_float, optional
String date (format, timestamp) timestamp, optional
Array getdate (timestamp)
Double mktime (hour, minute, second, month, day, year, is_dst)
Array gettimeofday (return_float) return_float, optional, returns an array of time information such as seconds and microseconds
URL processing
Array parse_url (string $ url (, int $ component =-1])
String urlencode (string $ str)
String urldecode (string $ str)
Obtain the PHP environment extension and function library activation
Array get_loaded_extensions ([bool $ zend_extensions = false])
Array get_extension_funcs (string $ module_name)
PREC regular expression
Int preg_match (string $ pattern, string $ subject [, array & $ matches [, int $ flags = 0 [, int $ offset = 0])
Int preg_match_all (string pattern, string subject, array matches [, int flags])
Mixed preg_replace (mixed pattern, mixed replacement, mixed subject [, int limit])
Related classes of mysqli
-- Connection between mysqli PHP and MySQL databases
--- Constructor
--- Mysqli (host, user, pass, db)
--- Method
--- Set_charset (gbk)
--- Character_set_name ()
--- Select_db (db)
--- Query (SQL)
--- Prepare (SQL) SQL: insert into table values (?,?)
--- Close ()
--- Attribute
--- Affected_rows
--- Error


-- Mysqli result class
--- Method
--- Fetch_array ()
--- Close ()
--- Attribute
--- Num_rows


-- Mysqli stmt class
--- Method
--- Bind_param (type, var ...)
--- Execute ()
--- Close ()
--- Attribute
--- Affected_rows
--- Error
--- Num_rows
--- Field_count select Statistical attribute

Explain SQL statement retains the character escape long get_magic_quotes_gpc (void) string addslashes (string str) string stripslashes (string str) character ASCI...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.