Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 47332

An array is an ordered data structure consisting of a collection of elements (values or variables), each identified by one (single dimensional array, or vector) or multiple indexes.

1 vote

Sort multidimensional array based on another one containing the desired order

$sorted = array_flip($order); foreach ($array as $value) { $id = $value['id']; $sorted[$id] = $value; } …
shudder's user avatar
  • 686
1 vote

Create a 2D array from SQL table

Also note $array[] notation inside while loop - equivalent for array_push() function - adding new rows will result in 2D array you need. …
shudder's user avatar
  • 686
5 votes

Merging website info into an array

Try this: $linkQuery = $xpath->query("//div[@class='news-archive']//a"); foreach ($linkQuery as $link) { $data[] = array('link' => $link->getAttribute('href'), 'title' => $link->nodeValue); } Btw … . array_map() is another way for traversing two (or more) arrays simultaneously: $group_elements = function($link, $title) { return array('link' => $link->value, 'title' => $title->nodeValue); }; …
shudder's user avatar
  • 686