This article for everyone to share the basic knowledge of PHP array functions for your reference, the specific contents are as follows
Array arrays are very important data types. It is more like a structure than other data types, and the result
1 Find character position function:
Strpos ($str, Search,[int]): Find the first position of search in $str starting from int;
Stripos ($str, search,[int]): function returns the position where the string first appears in another string. This function
Array: "Focus 1" implode (delimited, arr) concatenate the array value data by the specified character For example: $arr =array (' 1 ', ' 2 ', ' 3 ', ' 4 '); $str =implode ('-', $arr); Explode ([delimited],arr) splits a string by the specified
PHP can be said to be a very fire in the back-end language, it is small and small, and HTML and other front-end language can be said to be seamless, coupled with the advent of xampp,wampp and other tools, but also the front-end developers of the
Database operationsGetting Model objects$model = model Name:: Models (); or $model = new model name ();1. Querying multiple records (return value: two-dimensional array)$result = $model->findall ();$result = $model->findall (conditions);$result =
Judgment questionJudgment question (total Questions , 2 per question points) 1. There are only two values for Boolean type data in PHP: True and False. () ture and flase Chinese translation logic type2. The symbol for connecting two strings in PHP
PHP Array sorting function:Sort ()-ascending order of arraysRsort ()-Descending order of the arrayAsort ()-Sets the array in ascending order based on the values of the associative arraysKsort ()-an array is sorted in ascending order based on the
This article is mainly to share with you the PHP array functions in detail, mainly in the form of code and text and we introduce, hope to help everyone.
Array
Array belongs to composite type data
An array is actually an ordered map.
What is an array?
The registry is a large database. The key value is located at the end of the registry structure chain, similar to the file system file, containing the actual configuration information and data used by the current computer and
This article mainly introduces the contents of the PHP index array and associative array, has a certain reference value, now share to everyone, the need for friends can refer to
Recently encountered a bug, record
Define an array $arr = Array (' A
In this paper, the use of smarty built-in function foreach is described and shared for everyone's reference. Specific as follows:
Display file: index.php:Copy the Code code as follows: Create a Smarty ObjectRequire_once ("./libs/smarty.class.php");$
First, MVC1, entry fileThe only script file that allows the browser to request directly2, controller controllersResponsible for reconciling models and views3, modelOnly responsible for providing data, saving data4, viewDisplay only, and collect user
The Smarty template engine uses the built-in function foreach loop to take out all the array values, Smartyforeach
In this paper, the use of smarty built-in function foreach is described and shared for everyone's reference. Specific as
1 // Echo's notation 2 Echo "5 + ten =" . " "; 3 Echo "5+10 "; 4 Echo "5+10 = {$a} ";In PHP, there are three types of arrays:
Indexed array-an array with a numeric index
Associative array-An array with the specified key
We don't have a lot of PHP information on hand, we have a php4gb.chm. I most appreciate the library part of it, the real online help. But the pace of PHP development is so fast, you sui, I recently found some extended array functions in
Starting with version 5.2, PHP native provides Json_encode () and Json_decode () functions, which are used for encoding and decoding.
One, Json_encode ()
String Json_encode (mixed $value [, int $options = 0]): This function is primarily used to
1. Create an array
In programming languages, values and strings are called scalar variables, and a scalar variable can only represent a single numeric value or string. For example, $YDTX = the variable $ydtx in "mobile communication" is a scalar
1. Steps1. Making Connection objects$db New Mysqli (' localhost ', ' ', ', '); // The database server address is the IP address, local words also need to write the other IP address, database user name, database connection password, operation
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.