You are here: resetting arrays « PHP « IT news, forums, messages
resetting arrays

Posted by "I. Gray" on 10/20/35 11:19

Hi.

I am sure this is easy, but I can't get this work. Is there not a php
function that can do this?

I have an array- for example...
[1] => Yellow
[2] => Green
[3] => Purple
[4] => Blue
[5] => Red
[6] => Orange
[7] => Cyan

What happens, say if I delete [3] => Purple? I get...

[1] => Yellow
[2] => Green
[4] => Blue
[5] => Red
[6] => Orange
[7] => Cyan

But what if I want to reset the numbers? Like...

[1] => Yellow
[2] => Green
[3] => Blue
[4] => Red
[5] => Orange
[6] => Cyan

I've tried this...

unset($ses_basket_items[$pos]); for ($ii=0;
$ii<count($ses_basket_items); $ii++) {if (isset($ses_basket_items[$ii]))
{$cc++; $arry_a[$cc] = $ses_basket_items[$ii]; }} $ses_basket_items =
$arry_a;

where $pos is the position of the array I want to get rid of.
$ses_basket_items is session variable, does that matter?

Please help.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация