Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

prev(3) [php man page]

PREV(3) 								 1								   PREV(3)

prev - Rewind the internal array pointer

SYNOPSIS
mixed prev (array &$array) DESCRIPTION
Rewind the internal array pointer. prev(3) behaves just like next(3), except it rewinds the internal array pointer one place instead of advancing it. PARAMETERS
o $array - The input array. RETURN VALUES
Returns the array value in the previous place that's pointed to by the internal array pointer, or FALSE if there are no more elements. EXAMPLES
Example #1 Example use of prev(3) and friends <?php $transport = array('foot', 'bike', 'car', 'plane'); $mode = current($transport); // $mode = 'foot'; $mode = next($transport); // $mode = 'bike'; $mode = next($transport); // $mode = 'car'; $mode = prev($transport); // $mode = 'bike'; $mode = end($transport); // $mode = 'plane'; ?> NOTES
Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. Note You won't be able to distinguish the beginning of an array from a boolean FALSE element. To properly traverse an array which may contain FALSE elements, see the each(3) function. SEE ALSO
current(3), end(3), next(3), reset(3), each(3). PHP Documentation Group PREV(3)

Check Out this Related Man Page

RESET(3)								 1								  RESET(3)

reset - Set the internal pointer of an array to its first element

SYNOPSIS
mixed reset (array &$array) DESCRIPTION
reset(3) rewinds $array's internal pointer to the first element and returns the value of the first array element. PARAMETERS
o $array - The input array. RETURN VALUES
Returns the value of the first array element, or FALSE if the array is empty. EXAMPLES
Example #1 reset(3) example <?php $array = array('step one', 'step two', 'step three', 'step four'); // by default, the pointer is on the first element echo current($array) . "<br /> "; // "step one" // skip two steps next($array); next($array); echo current($array) . "<br /> "; // "step three" // reset pointer, start again on step one reset($array); echo current($array) . "<br /> "; // "step one" ?> SEE ALSO
current(3), each(3), end(3), next(3), prev(3). PHP Documentation Group RESET(3)
Man Page

9 More Discussions You Might Find Interesting

1. Programming

Pointers and array

hi all, let say i have a pointer exit, and this exit will store some value. how can i store the value that the pointer points to into an array and then print them out from the array. thanks in advance (2 Replies)
Discussion started by: dianazheng
2 Replies

2. UNIX for Dummies Questions & Answers

Help on TR

I want to do something like this: Original file: a car the house x tree After running the TR command I want this: a car the house tree I've already tried almost all combinations of the TR command, begin of line, \ , etc etc and I can't do it. Can anyone help? Or there is any other... (1 Reply)
Discussion started by: pmpx
1 Replies

3. UNIX for Dummies Questions & Answers

How can i read array elements dynamically in bash?

Hi friends how can we read array elements dynamically in bash shell? (1 Reply)
Discussion started by: haisubbu
1 Replies

4. Shell Programming and Scripting

function return array

Hi all I would like to know if there is a way to return an array for a function. As I know function can return all the contents in an array, I want to return an array type. (6 Replies)
Discussion started by: dophine
6 Replies

5. What is on Your Mind?

Interested in bike riding !!! share your exp..

Hi folks, i know its totally diff topic on this community ... :-) Are you interested in bike riding !!! if yes , what is your fav bike ? what bike are you having now at your home ? what is your longest ride ? I have a indian made 200cc bike .. most of the time, i... (2 Replies)
Discussion started by: vparunkumar
2 Replies

6. UNIX for Dummies Questions & Answers

car class (not school class)

im just trying to have some fun and kill some time writing a c++ program that has a person type in a car make and model then gives them a year and a price. or something like that. i always have problems getting it goin but once the ball is rolling im usually pretty good. anyone wanna help me out? ... (1 Reply)
Discussion started by: rickym2626
1 Replies

7. What is on Your Mind?

How long is your commute to work?

I'm just curious about the amount of time it takes you to get to work in the morning and whether you drive a car, ride a bike, walk or take public transportation. On a typical day I drive 10-15 minutes from my house to my work location followed by a 10 walk from the parking lot (car park to my... (12 Replies)
Discussion started by: bluescreen
12 Replies

8. Shell Programming and Scripting

Shell assign variable to another variable

How can I assign a variable to an variable. IE $car=honda One way I can do it is export $car=honda or let $car=2323 Is there any other ways to preform this task (3 Replies)
Discussion started by: 3junior
3 Replies

9. UNIX for Dummies Questions & Answers

Simple negated test condition

Without grep, I'd like to make a test condition so that any a word that does not have the successive letters car in it will be echoed. for example, bluecar will contain "car" so it will show up as a no var=bluecar $ echo $var|if ]; then echo "yes";fi yes this variable contains "car" so I... (5 Replies)
Discussion started by: newbie2010
5 Replies