On Jul 9, 2007, at 10:22 PM, David Krings wrote:

Cliff Hirsch wrote:
Look at array_slice

Based on the vote tally array_slice won, but I don't get this command. I just went for broke and tried my unset suspicion and indeed it works.

Your solution seems fine to me. You just save a couple of lines with array_splice.


Nevertheless, I am intrigued by array_slice, but I guess I postpone understanding that until tomorrow.

I think you want array_splice, not array_slice.

array_splice removes a section of an array an optionally replaces it with another array. It resets the keys of the array if it is numerically indexed. In your case, you leave out the replacement argument.

An example in your context might look like this:

array_splice($_SESSION['sessiondisplay'], $_SESSION ['sessionviewpointer'], 1);

This would only makes sense if $_SESSION['sessiondisplay'] is a numerically indexed array, and if $_SESSION['sessionviewpointer'] is an int.

-- Dell

_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to