# on 29-May-2015 (Fri)

Article 150891762

php 6

6.4 Looping Through Arrays with foreach As you just saw, it's easy to use each() in combination with while to loop through all the elements of an array. In fact, there's an even easier way: you can use PHP's foreach statement. foreach is a special kind of looping statement that works only on arrays (and objects). You can use it in two ways. You can either retrieve just the value of each element, or you can retrieve the element's key and value. Using foreach to Loop Through Values The simplest way to use foreach is to retrieve each element's value, as follows: foreach ( $array as$value ) { // (do something with $value here) } // (rest of script here) As you might imagine, the foreach loop continues to iterate until it has retrieved all the values in the array, from the first element to the last. On each pass through the loop, the$value variable gets set to the value of the current element. You can then do whateve

#### Flashcard 150892486

Question
sort() and rsort()
[default - edit me]

status measured difficulty not learned 37% [default] 0
php 6
on, then sort the array by number of purchases to see who your most loyal customers are. When it comes to sorting arrays, PHP provides no less than twelve functions that you can use to sort an array. The more common ones are: <span>sort() and rsort() — For sorting indexed arrays asort() and arsort() — For sorting associative arrays ksort() and krsort() — For sorting associative arrays by key rather than by value array_multisort

#### Flashcard 150892490

Question
sort() and rsort()
for sorting indexed arrays

status measured difficulty not learned 37% [default] 0
php 6
on, then sort the array by number of purchases to see who your most loyal customers are. When it comes to sorting arrays, PHP provides no less than twelve functions that you can use to sort an array. The more common ones are: <span>sort() and rsort() — For sorting indexed arrays asort() and arsort() — For sorting associative arrays ksort() and krsort() — For sorting associative arrays by key rather than by value array_multisort

#### Annotation 150892502

 indofloopingstatementthatworksonlyonarray

#### pdf

cannot see any pdfs

#### Annotation 150892506

 lkindofloopingstatementthatworksonly

#### pdf

cannot see any pdfs

#### pdf

cannot see any pdfs

#### Annotation 150892668

 tvariablesinPHP;inparticular,youlearnedthat

#### pdf

cannot see any pdfs

#### Flashcard 150892672

Question
statement that works