Re: [PHP] Simple array question, array delete

2005-04-06 Thread Ryan A
On 4/7/2005 5:19:24 AM, [EMAIL PROTECTED] wrote: > On Wed, April 6, 2005 6:09 am, Ryan A said: > > > when the user gives me a number, i have to check if its in the array > and > > > delete that entry...how do i do that? > > > I have looked at the manual but have gotten confused with array > > > po

Re: [PHP] Simple array question, array delete

2005-04-06 Thread Richard Lynch
On Wed, April 6, 2005 6:09 am, Ryan A said: > when the user gives me a number, i have to check if its in the array and > delete that entry...how do i do that? > I have looked at the manual but have gotten confused with array > pop,splice,array_key_exists etc http://php.net/array_search http://php.

RE: [PHP] Simple array question, part 2

2005-04-06 Thread Ryan A
Nope, array_shift()... is taking off the last one too Josip sent me the solution: $array = array_values($array); Cheers, Ryan On 4/6/2005 6:45:40 PM, Jay Blanchard ([EMAIL PROTECTED]) wrote: > [snip] > > Nope, array_pop is just deleting the last key/valuei need to reindex > > it > > with

Re: [PHP] Simple array question, part 2

2005-04-06 Thread Brent Baisley
Just so you know what is happening, the numbers are keys (index) for each array element, not the order number. It's the same as if you had named the elements themselves. Like this: ['zero']=>158 ['one']=>169926 ['two']=>169931 ... Or [0]=>158 [12]=>169926 [5]=>169931 ... Deleting an element won'

Re: [PHP] Simple array question, part 2

2005-04-06 Thread Ryan A
PERFECT! Thanks mate. -Ryan On 8/6/2005 6:47:22 PM, Josip Dzolonga ([EMAIL PROTECTED]) wrote: > Ryan A wrote: > > > > >what function should i lookup/use? > > > > > >Thanks, > > >Ryan > > > > > This will do the job : > > $array = array_values($array); > > > > Hope this helps, > > > >

RE: [PHP] Simple array question, part 2

2005-04-06 Thread Jay Blanchard
[snip] Nope, array_pop is just deleting the last key/valuei need to reindex it without deleteing anything. [/snip] Always reply to the list ('reply all') as the individual who answered you might not be there. Always. I mean it. You shouldn't just delete an item from an array, it is improper h

Re: [PHP] Simple array question, part 2

2005-04-06 Thread Philip Hallstrom
Hey, I have a $data array like this: [0] => 158 [1] => 169926 [2] => 169931 [3] => 169932 [4] => 169933 then when i delete the first one ([0] => 158) it becomes like this: [1] => 169926 [2] => 169931 [3] => 169932 [4] => 169933 how do I get it to sort again from 0,1,2,3

Re: [PHP] Simple array question, part 2

2005-04-06 Thread Josip Dzolonga
Ryan A wrote: what function should i lookup/use? Thanks, Ryan This will do the job : $array = array_values($array); Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.ph

RE: [PHP] Simple array question, part 2

2005-04-06 Thread Jay Blanchard
[snip] I have a $data array like this: [0] => 158 [1] => 169926 [2] => 169931 [3] => 169932 [4] => 169933 then when i delete the first one ([0] => 158) it becomes like this: [1] => 169926 [2] => 169931 [3] => 169932 [4] => 169933 how do I get it to sort again fr

Re: [PHP] Simple array question, array delete

2005-04-06 Thread Ken
On Apr 6, 2005 3:27 PM, Ken <[EMAIL PROTECTED]> wrote: > > On Apr 6, 2005 3:09 PM, Ryan A <[EMAIL PROTECTED]> wrote: > > > Hey, > > I have a $data_recs array like this: > > > > 12 > > 445 > > 45655 > > 4 > > 343 > > etc > > > > when the user gives me a number, i have to check if its in the

Re: [PHP] Simple array question, array delete

2005-04-06 Thread Ken
On Apr 6, 2005 3:09 PM, Ryan A <[EMAIL PROTECTED]> wrote: > > Hey, > I have a $data_recs array like this: > > 12 > 445 > 45655 > 4 > 343 > etc > > when the user gives me a number, i have to check if its in the array and > delete that entry...how do i do that? > I have looked at the manual bu

Re: [PHP] Simple array question, array delete

2005-04-06 Thread Josip Dzolonga
Ryan A wrote: Hey, I have a $data_recs array like this: 12 445 45655 4 343 etc when the user gives me a number, i have to check if its in the array and delete that entry...how do i do that? I have looked at the manual but have gotten confused with array pop,splice,array_key_exists etc Thanks, R

Re: [PHP] Simple array question

2003-10-22 Thread David Otton
On Thu, 23 Oct 2003 14:01:59 -0500, you wrote: >Is there a simple way to return the key (name) of one element in an >array? I looked up key() in the docs, but there are no examples or >notes... Ok, to make sure I understand you: given an array ('apple' => 'red', 'banana' => 'yellow') you wan

Re: [PHP] Simple array question

2003-10-22 Thread Jason Wong
On Friday 24 October 2003 03:01, René Fournier wrote: > Is there a simple way to return the key (name) of one element in an > array? I looked up key() in the docs, but there are no examples or > notes... array_search() -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software

Re: [PHP] Simple Array question

2003-07-29 Thread Adam Voigt
I think what you want is: Then on your next page, you can just do: foreach($_POST['id'] AS $row) echo $row; Or whatever, and that way you only get what you need. On Tue, 2003-07-29 at 13:08, Ryan A wrote: > Hi, > If i am posting something like this from a form: > > > > How do i

Re: [PHP] simple array question

2002-05-27 Thread Billy S Halsey
Jose, Try this: for ($i = 0; $i < $whatever; $i++) { $myArray[] = // ... } /bsh/ Jose Jeria wrote: > in javascript i can build an array doing like this: > > for(i=0; i < whatEver.length; i++){ > myArray[myArray.length] = // > } > > What is the equivalent to this in PHP? > Is this

Re: [PHP] simple array question (Am a Newbie kindly excuse.)

2002-05-10 Thread Pekka Saarinen
>Which gives out the output: >Tesing arrays: >ryan1, >ryan1.2, >ryan2, >ryan2.1.1.1.1.1, >ryan3, >ryan3.2, > >my question/problem is simply this: how do i stop the last comma from >coming? Hi, See http://www.php.net/manual/en/function.implode.php Pekka http://photography-on-the.net/ -- PHP

Re: [PHP] simple array question (Am a Newbie kindly excuse.)

2002-05-09 Thread Miguel Cruz
echo join (',', $a1); On Fri, 10 May 2002, r wrote: > Here is the code: > $a1[]="ryan1"; > $a1[]="ryan1.2"; > $a1[]="ryan2"; > $a1[]="ryan2.1.1.1.1.1"; > $a1[]="ryan3"; > $a1[]="ryan3.2"; > reset($a1); > > print("Tesing arrays:"); > while(list($aa1,$aa2) = each ($a1)) > { > print($aa2 . ","); >

RE: [PHP] simple array question (Am a Newbie kindly excuse.)

2002-05-09 Thread Matthew Walker
Try this: "); for($i=0; $i < count($a1); $i++) { { echo($a2[$i]); if ($i != (count($a1) - 1)) { echo ","; } } ?> Matthew Walker Senior Software Engineer ePliant Marketing -Original Message- From: r [mailto:[EMAIL PROTECTED]] Sent: Friday, May