Re: [PHP] How get the name of the array variable?

2002-02-15 Thread DL Neil

Lone Star Rick,
I see that your day, and helpfulness to list members, is going a lot better than mine!

> Actually, if I had my druthers, my domain TLD would be ".texas".  Some day,
> when Texas
> becomes the independent country it should be, that will be my TLD.
>
> 

If it comes from TX... it would have to be BIG!

There have been some moves in the last few days to get the .US TLD sorted out and 
properly mobilised. That would
give you -.TX.US. Santa Anna mightn't like it, but at least you could get to be both 
patriotic and parochial,
er, provincial !

=dn
Citizen of the world, and hoarder of TX jokes



> So Rick,
>
> Guess you've squashed my little scheme for (fraudulently) convincing
> everyone that I can speak Polish fluently -
> given that I counldn't answer Tomek's question, I'm already scoring it up as
> a 'bad day'!
>
> On the subject of email addresses, does this observation mean that we are
> patriotic but you are not?
>
> =dn
> OT polishing of PHP (Programming his Puns)
>
>
> > your mailing address TLD (the ".pl" in "emarket.pl") says you're from
> Poland
> >
> > > Please feel free to translate it into Polish.
> >
> > How did You know it was Polish? :)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




RE: [PHP] How get the name of the array variable?

2002-02-15 Thread Rick Emery

Actually, if I had my druthers, my domain TLD would be ".texas".  Some day,
when Texas
becomes the independent country it should be, that will be my TLD.



-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 15, 2002 8:57 AM
To: Rick Emery; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] How get the name of the array variable?


So Rick,

Guess you've squashed my little scheme for (fraudulently) convincing
everyone that I can speak Polish fluently -
given that I counldn't answer Tomek's question, I'm already scoring it up as
a 'bad day'!

On the subject of email addresses, does this observation mean that we are
patriotic but you are not?

=dn
OT polishing of PHP (Programming his Puns)


> your mailing address TLD (the ".pl" in "emarket.pl") says you're from
Poland
>
> > Please feel free to translate it into Polish.
>
> How did You know it was Polish? :)


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




Re: [PHP] How get the name of the array variable?

2002-02-15 Thread DL Neil

So Rick,

Guess you've squashed my little scheme for (fraudulently) convincing everyone that I 
can speak Polish fluently -
given that I counldn't answer Tomek's question, I'm already scoring it up as a 'bad 
day'!

On the subject of email addresses, does this observation mean that we are patriotic 
but you are not?

=dn
OT polishing of PHP (Programming his Puns)


> your mailing address TLD (the ".pl" in "emarket.pl") says you're from Poland
>
> > Please feel free to translate it into Polish.
>
> How did You know it was Polish? :)



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




RE: [PHP] How get the name of the array variable?

2002-02-15 Thread Rick Emery

your mailing address TLD (the ".pl" in "emarket.pl") says you're from Poland

-Original Message-
From: Tomek Golembiewski [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 15, 2002 7:20 AM
To: DL Neil; [EMAIL PROTECTED]
Subject: Re: [PHP] How get the name of the array variable?
>
> Please feel free to translate it into Polish.

How did You know it was Polish? :)

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




Re: [PHP] How get the name of the array variable?

2002-02-15 Thread Tomek Golembiewski

> This doesn't solve the strval problem,
:((( it's the only problem I have
> but in my debug output I wasn't so
> interested in the array's name, as in the meaning/status of the data it
> contained. Here is an equivalent approach (- the idea of nesting the two
> functions was the subject of a conversation with Torben here, a few days
> back):
>
> Please feel free to translate it into Polish.

How did You know it was Polish? :)

> I haven't tried to time/test, but I figured that the array_walk() would be
> more efficient than writing an (interpreted) PHP loop to run through the
> entire array/list, even with the function call.

Efficient is not the main problem when U debuging scripts IMHO.

I found that on php.net in doc.

function db($call,$cname)
{
// call: the variable you want to print_r
// cname: the label for your debugging output

if (DEBUG)
 {
 global $SCRIPT_NAME;
echo "$cname in  $SCRIPT_NAME";
if (!is_array($call)) { $call=htmlspecialchars($call); }
print_r($call);
if ( is_array($call)) { reset($call); }
echo "--";
} // end function db() ==
}

Very nice IMO, but still not solve the value name problem.
BTW it's third solution that I see and every one of them have "label for your 
debugging output" given as parameter.

But I'm very lezy and  I prefer to write down db($my_var) then 
db($my_var,"this is my_var"),
I doing lot's of debugin.

Regards,
TG


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




Re: [PHP] How get the name of the array variable?

2002-02-15 Thread DL Neil

Tomek,

> I got the problem , I want make preety debug function that shows array keys
> and values and name of the variable containing array:
> Here it is:
>
> function show_arr($array)
> //wyswietla wartosci z tablicy wraz z kluczami (przeznaczone do debugowania)
> {
> if(DABUG)
> {
> echo "---";
> echo "Array contents".strval($array)."";
> while(list($k,$v)=each($array))
> {
> echo "$k = $v";
> }
> echo "---";
> }
> }
>
> unfortunatly strval want work with arrays...
> Any possible solution how to get name of the array variable?


This doesn't solve the strval problem, but in my debug output I wasn't so interested 
in the array's name, as in
the meaning/status of the data it contained. Here is an equivalent approach (- the 
idea of nesting the two
functions was the subject of a conversation with Torben here, a few days back):

Function ShowList( $title, $aList )
// Debug output routine to echo an array/list to the screen
//requires a documentary name for the list as $title
//requires the array to be listed as $aList
//  NB co-requisite FnShowListItem
{
 echo "Listing array=$title: n=" . count( $aList );
 array_walk( $aList, "FnShowListItem" );
 }
Function FnShowListItem( $item, $key ) { echo "$key=" . $item . "~"; }
//end of function ShowList

In the main routine make a call something like:
if ( DEBUG ) ShowList( "Prefixed", $aURLs );

Please feel free to translate it into Polish.

I haven't tried to time/test, but I figured that the array_walk() would be more 
efficient than writing an
(interpreted) PHP loop to run through the entire array/list, even with the function 
call.

Perhaps someone can confirm/refute that?

Regards,
=dn



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