MemoryRefresh!

Pointer



Questions Answers 0%

Pages   0 from 51
Questions   0 from 84

Reset



key, current, next, reset
<?php $arr = array('a' => 1, 'b' => 2, 'c' => 3); reset($arr); while (key($arr) !== NULL) { echo key($arr) . current($arr) . " "; next($arr); } // Output: a1 b2 c3 end, prev
<?php // You could start your iteration from the last element $arr = array('a' => 1, 'b' => 2, 'c' => 3); end($arr); while (key($arr) !== NULL) { echo key($arr) . current($arr) . " "; prev($arr); } // Output: c3 b2 a1
Questions

Related pages

Basics !
Operations !
Create !
Key-value !
Search !
Modify !
Pointer !
Sort !
Stacks !
Randomize !
Storage !


0% 100%
 
 
0 pages 51 pages
1) How do you get current key from an array?




2) Advance the pointer in the array




Last Review: n/a   Passed: n/a   Reviews: n/a   Next Review: n/a  


key, current, next, reset
<?php $arr = array('a' => 1, 'b' => 2, 'c' => 3); reset($arr); while (key($arr) !== NULL) { echo key($arr) . current($arr) . " "; next($arr); } // Output: a1 b2 c3 end, prev
<?php // You could start your iteration from the last element $arr = array('a' => 1, 'b' => 2, 'c' => 3); end($arr); while (key($arr) !== NULL) { echo key($arr) . current($arr) . " "; prev($arr); } // Output: c3 b2 a1



More from Php

Basics
Variables
Operators
Function
Array
String
Streams
Uncategorized


More from Programming

Php
jQuery




Powered by minte9.com