Re: [PHP] RE: Printing structure and data of array

2002-01-22 Thread matthias.stache

Use this:


function debugPrint($mVar, $bHtml) {
 if ($bHtml){
  echo pre;
  print_r ($mVar);
  echo /pre;
 } else {
  print_r ($mVar);
 }
}

call it like this:

debugPrint($yourVariable,1);


This will print out any type (object,array,ressource,string...)

- Original Message -
From: Sandeep Murphy [EMAIL PROTECTED]
To: 'Tim Ward' [EMAIL PROTECTED]; PHP List
[EMAIL PROTECTED]
Sent: Tuesday, January 22, 2002 1:00 PM
Subject: RE: [PHP] RE: Printing structure and data of array


 hi,

 how can I display the array exactly as it is the format specified??? like
if
 their exists sub elements of elements, how could I represent them in a
 multidimensional format??

 I went thru most of the array functions but unable to adapt any of them..

 pl help..

 TIA,
 sands

 -Original Message-
 From: Tim Ward [mailto:[EMAIL PROTECTED]]
 Sent: segunda-feira, 21 de Janeiro de 2002 10:24
 To: PHP List; Daniel Alsén
 Subject: [PHP] RE: Printing structure and data of array


 Foreach($array as $key=$value) ech0($key=$valuebr);

 Tim
 www.chessish.com http://www.chessish.com

 --
 From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
 Sent:  20 January 2002 19:33
 To:  PHP List
 Subject:  Printing structure and data of array

 Hi,

 i know i have this answered before. But i can´t find that mail in
 the
 archive.

 How do i print an array to see both the structure and the data
 within?
 (test = value, test2 = value2)...

 # Daniel Alsén| www.mindbash.com #
 # [EMAIL PROTECTED]  | +46 704 86 14 92 #
 # ICQ: 63006462   | +46 8 694 82 22  #
 # PGP: http://www.mindbash.com/pgp/  #


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] RE: Printing structure and data of array

2002-01-22 Thread Sandeep Murphy

hi,

Thnx for the info but this is what I am using right now... It prints the
contents of array one below the other... is not showing the format of the
contents as i want...:(

any more suggestions??

thnx,
sands

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: terça-feira, 22 de Janeiro de 2002 12:43
To: PHP List
Subject: Re: [PHP] RE: Printing structure and data of array


Use this:


function debugPrint($mVar, $bHtml) {
 if ($bHtml){
  echo pre;
  print_r ($mVar);
  echo /pre;
 } else {
  print_r ($mVar);
 }
}

call it like this:

debugPrint($yourVariable,1);


This will print out any type (object,array,ressource,string...)

- Original Message -
From: Sandeep Murphy [EMAIL PROTECTED]
To: 'Tim Ward' [EMAIL PROTECTED]; PHP List
[EMAIL PROTECTED]
Sent: Tuesday, January 22, 2002 1:00 PM
Subject: RE: [PHP] RE: Printing structure and data of array


 hi,

 how can I display the array exactly as it is the format specified??? like
if
 their exists sub elements of elements, how could I represent them in a
 multidimensional format??

 I went thru most of the array functions but unable to adapt any of them..

 pl help..

 TIA,
 sands

 -Original Message-
 From: Tim Ward [mailto:[EMAIL PROTECTED]]
 Sent: segunda-feira, 21 de Janeiro de 2002 10:24
 To: PHP List; Daniel Alsén
 Subject: [PHP] RE: Printing structure and data of array


 Foreach($array as $key=$value) ech0($key=$valuebr);

 Tim
 www.chessish.com http://www.chessish.com

 --
 From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
 Sent:  20 January 2002 19:33
 To:  PHP List
 Subject:  Printing structure and data of array

 Hi,

 i know i have this answered before. But i can´t find that mail in
 the
 archive.

 How do i print an array to see both the structure and the data
 within?
 (test = value, test2 = value2)...

 # Daniel Alsén| www.mindbash.com #
 # [EMAIL PROTECTED]  | +46 704 86 14 92 #
 # ICQ: 63006462   | +46 8 694 82 22  #
 # PGP: http://www.mindbash.com/pgp/  #


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] RE: Printing structure and data of array

2002-01-22 Thread Tim Ward

how about ...

function ShowArray($array)
{   echo(ul);
foreach ($array as $key=$value)
{   echo(li$key)
if (is_array($value))
{   ShowArray($value);
} else
{   echo(=$value);
}
echo(/li)
}
echo(/ul);
} // end of fn ShowArray


Tim
www.chessish.com

 -Original Message-
 From: Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
 Sent: 22 January 2002 12:01
 To:   'Tim Ward'; PHP List
 Subject:  RE: [PHP] RE: Printing structure and data of array
 
 hi,
 
 how can I display the array exactly as it is the format specified??? like
 if
 their exists sub elements of elements, how could I represent them in a
 multidimensional format??
 
 I went thru most of the array functions but unable to adapt any of them..
 
 pl help..
 
 TIA,
 sands
 
 -Original Message-
 From: Tim Ward [mailto:[EMAIL PROTECTED]]
 Sent: segunda-feira, 21 de Janeiro de 2002 10:24
 To: PHP List; Daniel Alsén
 Subject: [PHP] RE: Printing structure and data of array
 
 
 Foreach($array as $key=$value) ech0($key=$valuebr);
 
 Tim
 www.chessish.com http://www.chessish.com 
 
   --
   From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
   Sent:  20 January 2002 19:33
   To:  PHP List
   Subject:  Printing structure and data of array
 
   Hi,
 
   i know i have this answered before. But i can´t find that mail in
 the
   archive.
 
   How do i print an array to see both the structure and the data
 within?
   (test = value, test2 = value2)...
 
   # Daniel Alsén| www.mindbash.com #
   # [EMAIL PROTECTED]  | +46 704 86 14 92 #
   # ICQ: 63006462   | +46 8 694 82 22  #
   # PGP: http://www.mindbash.com/pgp/  #
   
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] RE: Printing structure and data of array

2002-01-22 Thread Wolfram Kriesing

if you are using it for debugging try 
   print_r()
OR
   var_dump()


-- 
Wolfram


 function debugPrint($mVar, $bHtml) {
  global $HTTP_REFERER;
  if (is_array($mVar)){
   $sTemp = Array;
  }
  if (is_bool($mVar)){
   $sTemp = Bool;
  }
 [snip]
 ...
  $sFunction = debugPrint$sTemp; //getting the function to
 call to $sFunction($sTemp,$mVar,$bHtml); //calls the fuction
 }


 function debugPrintArray($sTemp,$mVar,$bHtml){
  $sInfo = brtype:  . $sTemp;
  if ($bHtml){
   echo brukey=value/u;
   foreach($mVar as $sKey = $sValue) {
$aFormData[$sKey] = $sValue;
echo bru.$sKey .  = /u;
echo u.$sValue . /u;
debugPrint($sValue,1);
   }
  } else {
  $sInfo = \ntype:  . $sTemp;
   echo key  --  value\n;
   foreach($mVar as $sKey = $sValue) {
$aFormData[$sKey] = $sValue;
echo \n.$sKey .  = ;
echo $sValue;
debugPrint($sValue,1);
   }
  }
 echo $sInfo;
 }

 function debugPrintBool($sTemp,$mVar,$bHtml){
  if ($bHtml){
 [snip]

 I'm not sure, the output 100% right but it should show how to use
 it. I attached the .php file.

 Greets

 - Original Message -
 From: Sandeep Murphy [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; PHP List
 [EMAIL PROTECTED] Sent: Tuesday, January 22, 2002 1:51 PM
 Subject: RE: [PHP] RE: Printing structure and data of array

  hi,
 
  Thnx for the info but this is what I am using right now... It
  prints the contents of array one below the other... is not
  showing the format of the contents as i want...:(
 
  any more suggestions??
 
  thnx,
  sands
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
  Sent: terça-feira, 22 de Janeiro de 2002 12:43
  To: PHP List
  Subject: Re: [PHP] RE: Printing structure and data of array
 
 
  Use this:
 
 
  function debugPrint($mVar, $bHtml) {
   if ($bHtml){
echo pre;
print_r ($mVar);
echo /pre;
   } else {
print_r ($mVar);
   }
  }
 
  call it like this:
 
  debugPrint($yourVariable,1);
 
 
  This will print out any type (object,array,ressource,string...)
 
  - Original Message -
  From: Sandeep Murphy [EMAIL PROTECTED]
  To: 'Tim Ward' [EMAIL PROTECTED]; PHP List
  [EMAIL PROTECTED]
  Sent: Tuesday, January 22, 2002 1:00 PM
  Subject: RE: [PHP] RE: Printing structure and data of array
 
   hi,
  
   how can I display the array exactly as it is the format
   specified???

 like

  if
 
   their exists sub elements of elements, how could I represent
   them in a multidimensional format??
  
   I went thru most of the array functions but unable to adapt any
   of

 them..

   pl help..
  
   TIA,
   sands
  
   -Original Message-
   From: Tim Ward [mailto:[EMAIL PROTECTED]]
   Sent: segunda-feira, 21 de Janeiro de 2002 10:24
   To: PHP List; Daniel Alsén
   Subject: [PHP] RE: Printing structure and data of array
  
  
   Foreach($array as $key=$value) ech0($key=$valuebr);
  
   Tim
   www.chessish.com http://www.chessish.com
  
   --
   From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
   Sent:  20 January 2002 19:33
   To:  PHP List
   Subject:  Printing structure and data of array
  
   Hi,
  
   i know i have this answered before. But i can´t find that mail
   in the
   archive.
  
   How do i print an array to see both the structure and the data
   within?
   (test = value, test2 = value2)...
  
   # Daniel Alsén| www.mindbash.com #
   # [EMAIL PROTECTED]  | +46 704 86 14 92 #
   # ICQ: 63006462   | +46 8 694 82 22  #
   # PGP: http://www.mindbash.com/pgp/  #
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail:
   [EMAIL PROTECTED]
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail:
   [EMAIL PROTECTED]
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail:
  [EMAIL PROTECTED]
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail:
  [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] RE: Printing structure and data of array

2002-01-22 Thread Sandeep Murphy


nope...

It continues to print in a single column indexed from 0 to  It does not
print the sub elements as sub elements.

any more ideas???

regards,
sands
-Original Message-
From: Tim Ward [mailto:[EMAIL PROTECTED]]
Sent: terça-feira, 22 de Janeiro de 2002 12:56
To: Sandeep Murphy; PHP List
Subject: RE: [PHP] RE: Printing structure and data of array


how about ...

function ShowArray($array)
{   echo(ul);
foreach ($array as $key=$value)
{   echo(li$key)
if (is_array($value))
{   ShowArray($value);
} else
{   echo(=$value);
}
echo(/li)
}
echo(/ul);
} // end of fn ShowArray


Tim
www.chessish.com

 -Original Message-
 From: Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
 Sent: 22 January 2002 12:01
 To:   'Tim Ward'; PHP List
 Subject:  RE: [PHP] RE: Printing structure and data of array
 
 hi,
 
 how can I display the array exactly as it is the format specified??? like
 if
 their exists sub elements of elements, how could I represent them in a
 multidimensional format??
 
 I went thru most of the array functions but unable to adapt any of them..
 
 pl help..
 
 TIA,
 sands
 
 -Original Message-
 From: Tim Ward [mailto:[EMAIL PROTECTED]]
 Sent: segunda-feira, 21 de Janeiro de 2002 10:24
 To: PHP List; Daniel Alsén
 Subject: [PHP] RE: Printing structure and data of array
 
 
 Foreach($array as $key=$value) ech0($key=$valuebr);
 
 Tim
 www.chessish.com http://www.chessish.com 
 
   --
   From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
   Sent:  20 January 2002 19:33
   To:  PHP List
   Subject:  Printing structure and data of array
 
   Hi,
 
   i know i have this answered before. But i can´t find that mail in
 the
   archive.
 
   How do i print an array to see both the structure and the data
 within?
   (test = value, test2 = value2)...
 
   # Daniel Alsén| www.mindbash.com #
   # [EMAIL PROTECTED]  | +46 704 86 14 92 #
   # ICQ: 63006462   | +46 8 694 82 22  #
   # PGP: http://www.mindbash.com/pgp/  #
   
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] RE: Printing structure and data of array

2002-01-22 Thread Tim Ward

I may have lost the original problem, but I thought you wanted a way of
displaying the structure of an array hierarchy,
e.g.
$fred[0][0] = array(length=10, width=20);
$fred[0][1] = array(length=20, width=30);
$fred[0][2] = array(length=30, width=20);
$fred[0][3] = Hello world;
$fred[1] = another string;

if this isn't what you're trying to do I apologise for misinterpreting the
question

Tim Ward
Senior Systems Engineer

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html

 -Original Message-
 From: Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
 Sent: 22 January 2002 14:42
 To:   'Tim Ward'; PHP List
 Subject:  RE: [PHP] RE: Printing structure and data of array
 
 
 nope...
 
 It continues to print in a single column indexed from 0 to  It does
 not
 print the sub elements as sub elements.
 
 any more ideas???
 
 regards,
 sands
 -Original Message-
 From: Tim Ward [mailto:[EMAIL PROTECTED]]
 Sent: terça-feira, 22 de Janeiro de 2002 12:56
 To: Sandeep Murphy; PHP List
 Subject: RE: [PHP] RE: Printing structure and data of array
 
 
 how about ...
 
 function ShowArray($array)
 { echo(ul);
   foreach ($array as $key=$value)
   {   echo(li$key)
   if (is_array($value))
   {   ShowArray($value);
   } else
   {   echo(=$value);
   }
   echo(/li)
   }
   echo(/ul);
 } // end of fn ShowArray
 
 
   Tim
   www.chessish.com
 
  -Original Message-
  From:   Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
  Sent:   22 January 2002 12:01
  To: 'Tim Ward'; PHP List
  Subject:RE: [PHP] RE: Printing structure and data of array
  
  hi,
  
  how can I display the array exactly as it is the format specified???
 like
  if
  their exists sub elements of elements, how could I represent them in a
  multidimensional format??
  
  I went thru most of the array functions but unable to adapt any of
 them..
  
  pl help..
  
  TIA,
  sands
  
  -Original Message-
  From: Tim Ward [mailto:[EMAIL PROTECTED]]
  Sent: segunda-feira, 21 de Janeiro de 2002 10:24
  To: PHP List; Daniel Alsén
  Subject: [PHP] RE: Printing structure and data of array
  
  
  Foreach($array as $key=$value) ech0($key=$valuebr);
  
  Tim
  www.chessish.com http://www.chessish.com 
  
  --
  From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
  Sent:  20 January 2002 19:33
  To:  PHP List
  Subject:  Printing structure and data of array
  
  Hi,
  
  i know i have this answered before. But i can´t find that mail in
  the
  archive.
  
  How do i print an array to see both the structure and the data
  within?
  (test = value, test2 = value2)...
  
  # Daniel Alsén| www.mindbash.com #
  # [EMAIL PROTECTED]  | +46 704 86 14 92 #
  # ICQ: 63006462   | +46 8 694 82 22  #
  # PGP: http://www.mindbash.com/pgp/  #
  
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] RE: Printing structure and data of array

2002-01-22 Thread Joffrey van Wageningen

how about:

?
$a = array(dit = array(zus, zo, bla), nog = array(wat, van,
dit = array(is, dat)), bla);

function displayarr($arr)
  {
  $c = ;
  echo array(;
  foreach($arr as $key = $val)
{
if($c)
  echo , ;

if(is_array($key))
  displayarr($key);
else
  echo \.$key.\ = ;

if(is_array($val))
  displayarr($val);
else
  echo \.$val.\;

$c++;
}
  echo );
  }

displayarr($a);

?

it prints the output just like you would enter it in your code...

with kind regards,
Joffrey van Wageningen
ne2000.nl

- Original Message -
From: Sandeep Murphy [EMAIL PROTECTED]
To: 'Tim Ward' [EMAIL PROTECTED]; PHP List
[EMAIL PROTECTED]
Sent: Tuesday, January 22, 2002 3:41 PM
Subject: RE: [PHP] RE: Printing structure and data of array



 nope...

 It continues to print in a single column indexed from 0 to  It does
not
 print the sub elements as sub elements.

 any more ideas???

 regards,
 sands
 -Original Message-
 From: Tim Ward [mailto:[EMAIL PROTECTED]]
 Sent: terça-feira, 22 de Janeiro de 2002 12:56
 To: Sandeep Murphy; PHP List
 Subject: RE: [PHP] RE: Printing structure and data of array


 how about ...

 function ShowArray($array)
 { echo(ul);
 foreach ($array as $key=$value)
 { echo(li$key)
 if (is_array($value))
 { ShowArray($value);
 } else
 { echo(=$value);
 }
 echo(/li)
 }
 echo(/ul);
 } // end of fn ShowArray


 Tim
 www.chessish.com

  -Original Message-
  From: Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
  Sent: 22 January 2002 12:01
  To: 'Tim Ward'; PHP List
  Subject: RE: [PHP] RE: Printing structure and data of array
 
  hi,
 
  how can I display the array exactly as it is the format specified???
like
  if
  their exists sub elements of elements, how could I represent them in a
  multidimensional format??
 
  I went thru most of the array functions but unable to adapt any of
them..
 
  pl help..
 
  TIA,
  sands
 
  -Original Message-
  From: Tim Ward [mailto:[EMAIL PROTECTED]]
  Sent: segunda-feira, 21 de Janeiro de 2002 10:24
  To: PHP List; Daniel Alsén
  Subject: [PHP] RE: Printing structure and data of array
 
 
  Foreach($array as $key=$value) ech0($key=$valuebr);
 
  Tim
  www.chessish.com http://www.chessish.com
 
  --
  From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
  Sent:  20 January 2002 19:33
  To:  PHP List
  Subject:  Printing structure and data of array
 
  Hi,
 
  i know i have this answered before. But i can´t find that mail in
  the
  archive.
 
  How do i print an array to see both the structure and the data
  within?
  (test = value, test2 = value2)...
 
  # Daniel Alsén| www.mindbash.com #
  # [EMAIL PROTECTED]  | +46 704 86 14 92 #
  # ICQ: 63006462   | +46 8 694 82 22  #
  # PGP: http://www.mindbash.com/pgp/  #
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] RE: Printing structure and data of array

2002-01-22 Thread Sandeep Murphy


Hey!

No need to apologise!!! If it werent for guys like u newbies like us would
hv a head full of grey hair!! honestly, methinks u guys rock!!

well, coming bak to the problem, I guess I have the posted the same problem
a few times in this list and receiving none or different answers

may i am asking a bit too much wud appreciate if anyone has the time to help
me out...:)

for clarity sake, i am going to explain my problem again If anything is
missing, pl lemme know..


I have an XML tree which I am parsing using DOM...

The tree has elements, sub elements and attributes like the following:

app // MAIN APP  (can hv any number of sub applications)
namesan/name
age23/age
   app// THIS IS AN SUB APPLICATION 
 namesan/name
 age23/age
url type=defaultyahoo.com/url
   /app   
/app
app
/app   and so on...

the elements are being stored consecutively in the array and displays them
as such, which is not how I want 

The array shud output such that the main app and sub app are distinguishable
from each other..

Thnx again...

sands
-Original Message-
From: Tim Ward [mailto:[EMAIL PROTECTED]]
Sent: terça-feira, 22 de Janeiro de 2002 14:48
To: Sandeep Murphy; PHP List
Subject: RE: [PHP] RE: Printing structure and data of array


I may have lost the original problem, but I thought you wanted a way of
displaying the structure of an array hierarchy,
e.g.
$fred[0][0] = array(length=10, width=20);
$fred[0][1] = array(length=20, width=30);
$fred[0][2] = array(length=30, width=20);
$fred[0][3] = Hello world;
$fred[1] = another string;

if this isn't what you're trying to do I apologise for misinterpreting the
question

Tim Ward
Senior Systems Engineer

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html

 -Original Message-
 From: Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
 Sent: 22 January 2002 14:42
 To:   'Tim Ward'; PHP List
 Subject:  RE: [PHP] RE: Printing structure and data of array
 
 
 nope...
 
 It continues to print in a single column indexed from 0 to  It does
 not
 print the sub elements as sub elements.
 
 any more ideas???
 
 regards,
 sands
 -Original Message-
 From: Tim Ward [mailto:[EMAIL PROTECTED]]
 Sent: terça-feira, 22 de Janeiro de 2002 12:56
 To: Sandeep Murphy; PHP List
 Subject: RE: [PHP] RE: Printing structure and data of array
 
 
 how about ...
 
 function ShowArray($array)
 { echo(ul);
   foreach ($array as $key=$value)
   {   echo(li$key)
   if (is_array($value))
   {   ShowArray($value);
   } else
   {   echo(=$value);
   }
   echo(/li)
   }
   echo(/ul);
 } // end of fn ShowArray
 
 
   Tim
   www.chessish.com
 
  -Original Message-
  From:   Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
  Sent:   22 January 2002 12:01
  To: 'Tim Ward'; PHP List
  Subject:RE: [PHP] RE: Printing structure and data of array
  
  hi,
  
  how can I display the array exactly as it is the format specified???
 like
  if
  their exists sub elements of elements, how could I represent them in a
  multidimensional format??
  
  I went thru most of the array functions but unable to adapt any of
 them..
  
  pl help..
  
  TIA,
  sands
  
  -Original Message-
  From: Tim Ward [mailto:[EMAIL PROTECTED]]
  Sent: segunda-feira, 21 de Janeiro de 2002 10:24
  To: PHP List; Daniel Alsén
  Subject: [PHP] RE: Printing structure and data of array
  
  
  Foreach($array as $key=$value) ech0($key=$valuebr);
  
  Tim
  www.chessish.com http://www.chessish.com 
  
  --
  From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
  Sent:  20 January 2002 19:33
  To:  PHP List
  Subject:  Printing structure and data of array
  
  Hi,
  
  i know i have this answered before. But i can´t find that mail in
  the
  archive.
  
  How do i print an array to see both the structure and the data
  within?
  (test = value, test2 = value2)...
  
  # Daniel Alsén| www.mindbash.com #
  # [EMAIL PROTECTED]  | +46 704 86 14 92 #
  # ICQ: 63006462   | +46 8 694 82 22  #
  # PGP: http://www.mindbash.com/pgp/  #
  
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] RE: Printing structure and data of array

2002-01-22 Thread Tim Ward

I understand now, your problem is not how display the array but how to get
it in a meaningful structure in the first place
i.e.
$app[0][name] = san;
$app[0][age] = 23;
$app[0][app][name] = san;
$app[0][app][age] = 23;
etc.
is that valid XML? (I'm not that up on XML and can't find anything in the
docs). If so you'll need to do some fancier regular expression stuff than
you already are to separate out the sub-application

Tim
www.chessish.com

 -Original Message-
 From: Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
 Sent: 22 January 2002 15:25
 To:   'Tim Ward'; PHP List
 Subject:  RE: [PHP] RE: Printing structure and data of array
 
 
 Hey!
 
 No need to apologise!!! If it werent for guys like u newbies like us would
 hv a head full of grey hair!! honestly, methinks u guys rock!!
 
 well, coming bak to the problem, I guess I have the posted the same
 problem
 a few times in this list and receiving none or different answers
 
 may i am asking a bit too much wud appreciate if anyone has the time to
 help
 me out...:)
 
 for clarity sake, i am going to explain my problem again If anything
 is
 missing, pl lemme know..
 
 
 I have an XML tree which I am parsing using DOM...
 
 The tree has elements, sub elements and attributes like the following:
 
 app // MAIN APP  (can hv any number of sub applications)
   namesan/name
   age23/age
  app// THIS IS AN SUB APPLICATION 
namesan/name
age23/age
   url type=defaultyahoo.com/url
  /app   
 /app
 app
 /app   and so on...
 
 the elements are being stored consecutively in the array and displays them
 as such, which is not how I want 
 
 The array shud output such that the main app and sub app are
 distinguishable
 from each other..
 
 Thnx again...
 
 sands
 -Original Message-
 From: Tim Ward [mailto:[EMAIL PROTECTED]]
 Sent: terça-feira, 22 de Janeiro de 2002 14:48
 To: Sandeep Murphy; PHP List
 Subject: RE: [PHP] RE: Printing structure and data of array
 
 
 I may have lost the original problem, but I thought you wanted a way of
 displaying the structure of an array hierarchy,
 e.g.
 $fred[0][0] = array(length=10, width=20);
 $fred[0][1] = array(length=20, width=30);
 $fred[0][2] = array(length=30, width=20);
 $fred[0][3] = Hello world;
 $fred[1] = another string;
 
 if this isn't what you're trying to do I apologise for misinterpreting the
 question
 
   Tim Ward
   Senior Systems Engineer
 
 Please refer to the following disclaimer in respect of this message:
 http://www.stivesdirect.com/e-mail-disclaimer.html
 
  -Original Message-
  From:   Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
  Sent:   22 January 2002 14:42
  To: 'Tim Ward'; PHP List
  Subject:RE: [PHP] RE: Printing structure and data of array
  
  
  nope...
  
  It continues to print in a single column indexed from 0 to  It does
  not
  print the sub elements as sub elements.
  
  any more ideas???
  
  regards,
  sands
  -Original Message-
  From: Tim Ward [mailto:[EMAIL PROTECTED]]
  Sent: terça-feira, 22 de Janeiro de 2002 12:56
  To: Sandeep Murphy; PHP List
  Subject: RE: [PHP] RE: Printing structure and data of array
  
  
  how about ...
  
  function ShowArray($array)
  {   echo(ul);
  foreach ($array as $key=$value)
  {   echo(li$key)
  if (is_array($value))
  {   ShowArray($value);
  } else
  {   echo(=$value);
  }
  echo(/li)
  }
  echo(/ul);
  } // end of fn ShowArray
  
  
  Tim
  www.chessish.com
  
   -Original Message-
   From: Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
   Sent: 22 January 2002 12:01
   To:   'Tim Ward'; PHP List
   Subject:  RE: [PHP] RE: Printing structure and data of array
   
   hi,
   
   how can I display the array exactly as it is the format specified???
  like
   if
   their exists sub elements of elements, how could I represent them in a
   multidimensional format??
   
   I went thru most of the array functions but unable to adapt any of
  them..
   
   pl help..
   
   TIA,
   sands
   
   -Original Message-
   From: Tim Ward [mailto:[EMAIL PROTECTED]]
   Sent: segunda-feira, 21 de Janeiro de 2002 10:24
   To: PHP List; Daniel Alsén
   Subject: [PHP] RE: Printing structure and data of array
   
   
   Foreach($array as $key=$value) ech0($key=$valuebr);
   
   Tim
   www.chessish.com http://www.chessish.com 
   
 --
 From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
 Sent:  20 January 2002 19:33
 To:  PHP List
 Subject:  Printing structure and data of array
   
 Hi,
   
 i know i have this answered before. But i can´t find that mail in
   the
 archive.
   
 How do i print an array to see both the structure and the data
   within?
 (test = value, test2 = value2)...
   
 # Daniel Alsén| www.mindbash.com #
 # [EMAIL

RE: [PHP] RE: Printing structure and data of array

2002-01-22 Thread Sandeep Murphy

exactly!
fancier regular expression is what I am looking for here:)

thnx anyway...

if anyone else has any suggestions.. welcome...

regards,

sands


-Original Message-
From: Tim Ward [mailto:[EMAIL PROTECTED]]
Sent: terça-feira, 22 de Janeiro de 2002 16:13
To: Sandeep Murphy; Tim Ward; PHP List
Subject: RE: [PHP] RE: Printing structure and data of array


I understand now, your problem is not how display the array but how to get
it in a meaningful structure in the first place
i.e.
$app[0][name] = san;
$app[0][age] = 23;
$app[0][app][name] = san;
$app[0][app][age] = 23;
etc.
is that valid XML? (I'm not that up on XML and can't find anything in the
docs). If so you'll need to do some fancier regular expression stuff than
you already are to separate out the sub-application

Tim
www.chessish.com

 -Original Message-
 From: Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
 Sent: 22 January 2002 15:25
 To:   'Tim Ward'; PHP List
 Subject:  RE: [PHP] RE: Printing structure and data of array
 
 
 Hey!
 
 No need to apologise!!! If it werent for guys like u newbies like us would
 hv a head full of grey hair!! honestly, methinks u guys rock!!
 
 well, coming bak to the problem, I guess I have the posted the same
 problem
 a few times in this list and receiving none or different answers
 
 may i am asking a bit too much wud appreciate if anyone has the time to
 help
 me out...:)
 
 for clarity sake, i am going to explain my problem again If anything
 is
 missing, pl lemme know..
 
 
 I have an XML tree which I am parsing using DOM...
 
 The tree has elements, sub elements and attributes like the following:
 
 app // MAIN APP  (can hv any number of sub applications)
   namesan/name
   age23/age
  app// THIS IS AN SUB APPLICATION 
namesan/name
age23/age
   url type=defaultyahoo.com/url
  /app   
 /app
 app
 /app   and so on...
 
 the elements are being stored consecutively in the array and displays them
 as such, which is not how I want 
 
 The array shud output such that the main app and sub app are
 distinguishable
 from each other..
 
 Thnx again...
 
 sands
 -Original Message-
 From: Tim Ward [mailto:[EMAIL PROTECTED]]
 Sent: terça-feira, 22 de Janeiro de 2002 14:48
 To: Sandeep Murphy; PHP List
 Subject: RE: [PHP] RE: Printing structure and data of array
 
 
 I may have lost the original problem, but I thought you wanted a way of
 displaying the structure of an array hierarchy,
 e.g.
 $fred[0][0] = array(length=10, width=20);
 $fred[0][1] = array(length=20, width=30);
 $fred[0][2] = array(length=30, width=20);
 $fred[0][3] = Hello world;
 $fred[1] = another string;
 
 if this isn't what you're trying to do I apologise for misinterpreting the
 question
 
   Tim Ward
   Senior Systems Engineer
 
 Please refer to the following disclaimer in respect of this message:
 http://www.stivesdirect.com/e-mail-disclaimer.html
 
  -Original Message-
  From:   Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
  Sent:   22 January 2002 14:42
  To: 'Tim Ward'; PHP List
  Subject:RE: [PHP] RE: Printing structure and data of array
  
  
  nope...
  
  It continues to print in a single column indexed from 0 to  It does
  not
  print the sub elements as sub elements.
  
  any more ideas???
  
  regards,
  sands
  -Original Message-
  From: Tim Ward [mailto:[EMAIL PROTECTED]]
  Sent: terça-feira, 22 de Janeiro de 2002 12:56
  To: Sandeep Murphy; PHP List
  Subject: RE: [PHP] RE: Printing structure and data of array
  
  
  how about ...
  
  function ShowArray($array)
  {   echo(ul);
  foreach ($array as $key=$value)
  {   echo(li$key)
  if (is_array($value))
  {   ShowArray($value);
  } else
  {   echo(=$value);
  }
  echo(/li)
  }
  echo(/ul);
  } // end of fn ShowArray
  
  
  Tim
  www.chessish.com
  
   -Original Message-
   From: Sandeep Murphy [SMTP:[EMAIL PROTECTED]]
   Sent: 22 January 2002 12:01
   To:   'Tim Ward'; PHP List
   Subject:  RE: [PHP] RE: Printing structure and data of array
   
   hi,
   
   how can I display the array exactly as it is the format specified???
  like
   if
   their exists sub elements of elements, how could I represent them in a
   multidimensional format??
   
   I went thru most of the array functions but unable to adapt any of
  them..
   
   pl help..
   
   TIA,
   sands
   
   -Original Message-
   From: Tim Ward [mailto:[EMAIL PROTECTED]]
   Sent: segunda-feira, 21 de Janeiro de 2002 10:24
   To: PHP List; Daniel Alsén
   Subject: [PHP] RE: Printing structure and data of array
   
   
   Foreach($array as $key=$value) ech0($key=$valuebr);
   
   Tim
   www.chessish.com http://www.chessish.com 
   
 --
 From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
 Sent:  20 January 2002

[PHP] RE: Printing structure and data of array

2002-01-21 Thread Tim Ward

Foreach($array as $key=$value) ech0($key=$valuebr);

Tim
www.chessish.com http://www.chessish.com 

--
From:  Daniel Alsén [SMTP:[EMAIL PROTECTED]]
Sent:  20 January 2002 19:33
To:  PHP List
Subject:  Printing structure and data of array

Hi,

i know i have this answered before. But i can´t find that mail in
the
archive.

How do i print an array to see both the structure and the data
within?
(test = value, test2 = value2)...

# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]