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
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.
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
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'
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,
>
>
>
>
[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
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
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
[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
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
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
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
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
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
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
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
>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
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 . ",");
>
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
19 matches
Mail list logo