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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.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 . ",");
> }
> 
> ?>
> 
> 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?

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




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 10, 2002 3:19 AM
To: [EMAIL PROTECTED]
Subject: [PHP] simple array question (Am a Newbie kindly excuse.)

Greetings my PHP people.
Will do things a bit backwork code first and what i want as that seems
the
easiest way to explain

Here is the code:
");
while(list($aa1,$aa2) = each ($a1))
{
print($aa2 . ",");
}

?>

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? because originally instead of giving the output to the browser i
want it to "feed" it to a hidden form field, which i enter into the
database
Yeah yeah yeah, wipe the tears of laugher from your eyes and remember,
you
too were once a newbie. :-o)
This list is great and i know i will get not one answer but many, thank
you
in advance.
-Ryan A.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php