Before I wrote a simple example of PHP return JSON data, just online, suddenly found an article, also introduced JSON, very detailed, worth reference. The contents are as follows
Starting with version 5.2, PHP native provides the Json_encode () and
Indexed array: An array with a numeric indexInitializing an array$arr Array (' value1 ', ' value2 ', ' value3 '); $arr = [' value1 ', ' value2 ', ' value3 ']; /* PHP5.4 version starts to support */Iterating through an arrayFor loop traversal: for ($
Introduction of PHP arrays1, the classification of the PHP arrayDivided into associative arrays and indexed arrays according to the different subscripts① Index Array: Subscript starts from 0 and grows sequentially② Associative array: The subscript
PHP5 Data typesString (String), Integer (integer), float (floating-point), Boolean (Boolean), Array (array), Object (objects), null (null value).stringYou can put any text in single and double quotation marks:"; $x = ' Hello world! '; Single quotes
PHP 5Array function
Introduction to PHP ArrayThe PHP array function allows you to access and manipulate the array.Supports simple arrays and multidimensional arrays.
InstallationThe PHP Array function is part of the PHP core. These
Array
PHP has two types of arrays: indexed arrays, associative arrays, indexes and associations two words are for the keys of an array, index subscript starting from 0
Initialization
Indexed array
Create an
2107/9/15 Friday
today I'm going to share a wave of arrays, so what is an array? An array is a contiguous memory space that stores multiple elements, which is equivalent to a collection of multiple variables, including array names and indexes,
1th Chapter JavaScript History 1.1 JavaScript originsJavaScript was developed by Netscape company in collaboration with Sun Corporation.JavaScript is an implementation of the ECMAScript standard, but in a general expression, the two refer to the
The first chapter is the definition of josn
Json:javascript Object notation
is a data structure of JavaScript (JScript, ECMA JavaScript, and so on) that describes object data (the various metadata is actually the simplest object). Concepts and
Hashtable is the most important and widely used data structure in the Zend engine, and it is used to store almost everything.1.2.1 Data structureThe hashtable data structure is defined as follows:
Copy Code code as follows:
typedef struct
At present, JSON has become one of the most popular data interchange formats, and almost all the APIs in the major Web sites support it.
I've written a data type and JSON format to explore its design ideas. Today, I want to summarize the PHP
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
First, basic knowledge
This chapter briefly describes the internal mechanisms of some Zend engines, which are closely related to extensions and can help us write more efficient PHP code.
Storage of 1.1 PHP variables
1.1.1 Zval Structure
Zend uses
$fruits =array (
"D" => "Lemon",
"A" => "orange",
"B" => "banana",
"C" => "Apple"); Define an array
Arsort ($fruits); Reverse-Sort the array
foreach ($fruits as $key => $val)//Cyclic output the key value pairs of the array after sorting
Copy Code code as follows:
var person = new Array ();
PERSON[0] = 120;//defines a person's weight of 120 kg
PERSON[1] = 21;//Defines the age of the person 21 years old
document.write ("body weight =" +person[0]+ "age =" +person[1])/output
Before I wrote a simple example of PHP return JSON data, just surf the internet, suddenly found an article, also introduced JSON, quite detailed, it is worth reference. The contents are as follows
Starting with version 5.2, PHP native provides Json_
First, basic knowledge
This chapter briefly describes the internal mechanisms of some Zend engines, which are closely related to extensions and can help us write more efficient PHP code.
Storage of 1.1 PHP variables
1.1.1 Zval Structure
Zend
Learning Focus:
Numeric index Array
Non-numeric indexed arrays
Array operators
Multidimensional arrays
Array sorting
Array functions
In the first and second chapters, the variables I use are scalar variables (only a
array of direct assignment declarations1. An array contains multiple contents, and the contents of an array are called "elements".2. Each element is a value that consists of a key and a value of Key/value,key subscript value$arr []=0; $arr [2]=2;
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.