[PHP] Problems with multiple arrays

2005-05-23 Thread virtualsoftware
Hi all,

I have 3 arrays:

$array _ids   = (id_1, id_2, id_3, id_4)

$array_names  = (name_1, name_2, name_3, name_4)

$array_emails = (email_1, email_2, email_3, email_4)

I want to create an array that contains all this arrays and then to print the 
array.

Something like that:

   foreach ($full_data as $key = $value)
{

 echo $valuebr;
 }

and the result must be:

  id_1 - name_1 - email_1
  id_2 - name_2 - email_2
  id_3 - name_3 - email_3
  id_4 - name_4 - email_4



Any help would be appreciated !!!

RE: [PHP] Problems with multiple arrays

2005-05-23 Thread Shaw, Chris - Accenture

Try this:

?php
$array_ids = array('id_1', 'id_2', 'id_3', 'id_4');
$array_names = array('name_1', 'name_2', 'name_3', 'name_4');
$array_emails = array('email_1', 'email_2', 'email_3', 'email_4');

$full_data [] = $array_ids;
$full_data [] = $array_names;
$full_data [] = $array_emails;

foreach ($full_data as $key = $value)
{
  echo $full_data[0][$key], ' - ', $full_data[1][$key], ' - ',
$full_data[2][$key], ' br';
}
?

Result:

id_1 - name_1 - email_1
id_2 - name_2 - email_2
id_3 - name_3 - email_3


I am sure someone that has been doing php for more than 2 weeks can better
that code. I am still a learner in php magic functions. ;)

C.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 23 May 2005 14:48
To: php-general@lists.php.net
Subject: [PHP] Problems with multiple arrays

Hi all,

I have 3 arrays:

$array _ids   = (id_1, id_2, id_3, id_4)

$array_names  = (name_1, name_2, name_3, name_4)

$array_emails = (email_1, email_2, email_3, email_4)

I want to create an array that contains all this arrays and then to print the
array.

Something like that:

   foreach ($full_data as $key = $value)
{

 echo $valuebr;
 }

and the result must be:

  id_1 - name_1 - email_1
  id_2 - name_2 - email_2
  id_3 - name_3 - email_3
  id_4 - name_4 - email_4



Any help would be appreciated !!!




This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*

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



RE: [PHP] Problems with multiple arrays

2005-05-23 Thread Shaw, Chris - Accenture

Sorry, sent the wrong code.

?php
$array_ids = array('id_1', 'id_2', 'id_3', 'id_4');
$array_names = array('name_1', 'name_2', 'name_3', 'name_4');
$array_emails = array('email_1', 'email_2', 'email_3', 'email_4');

$full_data [] = $array_ids;
$full_data [] = $array_names;
$full_data [] = $array_emails;

foreach ($full_data[0] as $key = $value)
{
  echo $full_data[0][$key], ' - ', $full_data[1][$key], ' - ',
$full_data[2][$key], ' br';
}
?

Result:

id_1 - name_1 - email_1
id_2 - name_2 - email_2
id_3 - name_3 - email_3
id_4 - name_4 - email_4




This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*

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



Re: [PHP] Problems with multiple arrays

2005-05-23 Thread Brent Baisley

For your result, you want to create the array something like this:

$array_data[] = array('id'='1', 'name'='1', 'email'='1');
$array_data[] = array('id'='2', 'name'='2', 'email'='2');
$array_data[] = array('id'='3', 'name'='3', 'email'='3');
...

Each array record will contain three fields.

On May 23, 2005, at 9:48 AM, [EMAIL PROTECTED] wrote:


Hi all,

I have 3 arrays:

$array _ids   = (id_1, id_2, id_3, id_4)

$array_names  = (name_1, name_2, name_3, name_4)

$array_emails = (email_1, email_2, email_3, email_4)

I want to create an array that contains all this arrays and then to 
print the array.


Something like that:

   foreach ($full_data as $key = $value)
{

 echo $valuebr;
 }

and the result must be:

  id_1 - name_1 - email_1
  id_2 - name_2 - email_2
  id_3 - name_3 - email_3
  id_4 - name_4 - email_4



Any help would be appreciated !!!

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

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