Results 1 to 2 of 2
  1. #1

    Deleting an item from an array??

    I was wondering if there was a way to delete an item from an array in PHP? for example....

    $var[1] = "stuff";
    $var[2] = "http";
    $var[3] = "www";
    $var[4] = "etc";

    and then delete one item, say, "3", and rename 4 to 3, so in the end it would be....

    $var[1] = "stuff";
    $var[2] = "http";
    $var[3] = "etc";

    Thanks in advance!

  2. #2
    Join Date
    Aug 2002
    San Jose, Costa Rica
    $var = array_reverse(array_reverse($var));

    You could also use sort to reindex.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts