What are the knowledge points you must know in PHP?

慕斯
Release: 2023-03-11 06:02:02
Original
1877 people have browsed it

We have learned so much about PHP, what are the knowledge points that you must know about PHP? Have you fully mastered it? If not, then follow this article to continue learning

Related recommendations:What is PDO in PHP? What are the common methods of using pdo objects?

Class and object processing functions:
class_alias(): Create an alias for a class
class_exists(): Check whether the class has been defined
get_called_class( :The name of the late static binding ("Late Static Binding") class get_class methods(): Returns an array consisting of the method names of the class
getclass_vars(: Returns an array consisting of the default attributes of the class get class(): Returns The class name of the object
get_declared_classes(): Returns an array consisting of the names of defined classes get declared_interfaces(): Returns an array containing all declared interfaces get_declared_traits(): Returns an array of all defined traits

get_object_vars(): Returns an associative array composed of object attributes get parent class(): Returns the parent class name of the object or class

interface_exists(): Checks whether the interface has been defined

is_a(): If the object belongs to this class or this class is the parent class of this object, it returns TRUEis subclass_of(): If this object is a subclass of this class, it returns TRUEmethod exists(): Check whether the method of the class exists
property exists(): Check whether the object or class has the attribute trait_exists(): Check whether the specified trait exists array-related functions
PDO database preprocessing function:
$pdo = new PDO(): Create a PDO object
$pdo->prepare(): Prepare the statement to be executed and return the statement object $stmt$stmt->bindParam(): Bind a parameter to the specified variable name
$stmt->bindValue(): Bind a value to a parameter Sstmt->bindColumn(): Bind a column to a PHP variable $stmt->execute(): Execute a prepared statement
$stmt->columnCount(): Returns a list in the result set $stmt->fecth(): Gets the next row from the result set
Sstmt->fecthAlII(): Returns a list containing all rows in the result set Array
$stmt->fecthColumn(): Returns a single column from the next row in the result set $stmt->fetchObject(): Gets the next row and returns it as an object
$stmt->rowCount( ): Returns the number of rows affected by the previous .SQL statement $stmt->setFetchMode(): Sets the default fetch mode for the statement
$stmt->debugDumpParams(): Prints a SQL preprocessing command
$stmt->errorCode(): Get the SQLSTATE related to the last statement handle operation
$stmt->errorInfo(): Get the extended error information related to the last statement handle operation File operation function

Commonly used array functions:
count()//Non-array returns 1.
key: Get the subscript of the element pointed to by the current pointer of the current array current: The current pointer obtained points to the element
next: Get the value of the next element, and move the pointer down prev: Get the value of the previous element, and move the pointer up
end: Move the pointer to the last element of the array, and return The value of the final pointer position reset: moves the pointer to the first element of the array, and returns the value of the final pointer position array keys: gets all the key names of an array, returns an index array array_values: gets all the values ​​of an array , Return an index array
explode: Divide a string into multiple segments according to a specified rule (usually special characters), each segment is regarded as an element of the
array, return an index array
split is similar to explodeexplode('.', 'abc.txt') is equal to split(.,'abc.txt')
implode: All elements in an array are processed according to a specified rule (special characters), Splice all the elements into a string
join() Combine the array elements into a string
array merge: Merge refers to accumulating the elements in the two arrays. If the following array has the same subscript (key name: association) as the previous array, then the value of the later element will overwrite the previous one; if the index here has the same subscript, the subscript will be automatically modified and added to the front. in the array.
array reverse—returns the reversed array
arrayflip-exchanges the keys and values ​​​​in the array
Data structure simulation function
array shift: Pop the element from the front of the array and get the value of the element array pop : Pop elements from the back of the array to get the value of the element
array unshift: Push elements from the front of the array to get the number of current array elements array push: Push elements from the back of the array to get the number of current array elements Number
Sort
rsort() function is used to sort array cells from high to low.
asort() function is used to sort the array cells from low to high and maintain the index relationship. The arsort() function is used to sort the array cells from high to low and maintain the index relationship.
The ksort() function is used to sort array cells from low to high by key name.
The krsort() function is used to sort array cells from high to low by key name.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What are the knowledge points you must know in PHP?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template