Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

print out variable name as well as its content

933 views
Skip to first unread message

Summercool

unread,
Oct 18, 2007, 7:52:42 PM10/18/07
to
I wonder in PHP, can you have a function like

print_debug($foo);

and it will print out:

$foo is:
3

that is, it will print out, most importantly, the variable name, as
well as its content.

Rik Wasmus

unread,
Oct 18, 2007, 8:03:54 PM10/18/07
to
On Fri, 19 Oct 2007 01:52:42 +0200, Summercool <Summerc...@gmail.com>
wrote:

No, as it's name should be of utter unimportance.

(Somewhere in this group there's been given a 'solution' for this about a
year ago I think. It involved using debug_backtrace(), fopen()ing the file
and reading/parsing the line indicated in that array. Not anything you
should want to do.)

As said, the variable name should be of no importance. If you're trying to
pinpoint changes in your script you can either use __FILE__ & __LINE__
along with the output, of use the debug_backtrace() mentioned earlier in a
function to output the file & line it was called.
--
Rik Wasmus

Summercool

unread,
Oct 18, 2007, 8:16:27 PM10/18/07
to
On Oct 18, 5:03 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Fri, 19 Oct 2007 01:52:42 +0200, Summercool <Summercooln...@gmail.com>

> wrote:
>
> > I wonder in PHP, can you have a function like
>
> > print_debug($foo);
>
> > and it will print out:
>
> > $foo is:
> > 3

> No, as it's name should be of utter unimportance.


>
> (Somewhere in this group there's been given a 'solution' for this about a
> year ago I think. It involved using debug_backtrace(), fopen()ing the file
> and reading/parsing the line indicated in that array. Not anything you
> should want to do.)

Coz in C and in Ruby, they are both possible...

in PHP, maybe you can do something like

print_debug("$foo");

and then define

function print_debug($s) {
echo $s, "\n";
print_r(eval($s));
}

?

but is there something that can work better?


Jerry Stuckle

unread,
Oct 18, 2007, 8:20:14 PM10/18/07
to

This is neither C nor Ruby. Don't try to compare them (and, BTW, it's
not part of the C language - it's the debug libraries you're using which
allow it).

If you want the variable's name, just say it!

echo '$foo=' . $foo;


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================

Summercool

unread,
Oct 18, 2007, 8:31:03 PM10/18/07
to
On Oct 18, 5:20 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:

> If you want the variable's name, just say it!
>
> echo '$foo=' . $foo;

sometimes it is more like

echo '$obj->arr[n*size][i-1]' . $obj->arr[n*size][i-1];

so you have to make sure both places are indeed the same expression --
no inconsistency between the two of them. so it would be handy to
just use

print_debug($obj->arr[n*size][i-1]);

and no need to check consistency all the time.


Message has been deleted
Message has been deleted

Summercool

unread,
Oct 18, 2007, 8:58:56 PM10/18/07
to
On Oct 18, 5:46 pm, Gary L. Burnore <gburn...@databasix.com> wrote:

> > echo '$obj->arr[n*size][i-1]' . $obj->arr[n*size][i-1];
>
> >so you have to make sure both places are indeed the same expression --
>

> If that's too hard for you, perhaps you should consider a job in the
> food or hospitality industry.

so if PHP or people who are proficient in PHP cannot give a good
solution to this simple thing, i wonder who should work in the food or
hospitality industry.


Rik Wasmus

unread,
Oct 18, 2007, 9:05:23 PM10/18/07
to
On Fri, 19 Oct 2007 02:58:56 +0200, Summercool <Summerc...@gmail.com>
wrote:

What is the actual 'simple' thing you're trying to solve, as I cannot see
any practical use in production for your proposed feature. Even for
debugging I'd rather know the file/line (which is easily retrievable) then
the variable name, as it sais so much more. Any normal production code
wouldn't need it at all as it should check variables, and on a fail rather
throw errors or exceptions then your debug info.
--
Rik Wasmus

macca

unread,
Oct 18, 2007, 9:08:54 PM10/18/07
to
Just an idea, but look up get_defined_vars() in the manual.

e.g.

<?php

// Test Variables

$test_var1 = 1;
$test_var2 = 2;
$another_var = "hello";

/*
get_defined_vars() returns a multidimensional array containing a
list
of all defined variables, be them environment, server or user-
defined
variables
*** WITHIN THE SCOPE get_defined_vars() IS CALLED ***

*/


$arr = get_defined_vars();

foreach ($arr as $key=>$value){

// Shows the different vars you can access
//each one is an array of the vars in that category


switch($key){
case "GLOBALS":
continue 2;
break;
case "_POST":
continue 2;
break;
case "_GET":
continue 2;
break;
case "_COOKIE":
continue 2;
break;
case "_FILES":
continue 2;
break;
}

echo $key ." => ". $value ."<br />";
}


//========================

/*
Outputs

test_var1 => 1
test_var2 => 2
another_var => hello

*/


?>

Regards,

Paul

Jerry Stuckle

unread,
Oct 18, 2007, 9:25:11 PM10/18/07
to

No, if you can't code a simple echo statement than you should be in the
food or hospitality industry.

We told you the answer. If you don't want to accept it, then the food
or hospitality industry sounds like a much better fit for you.

Michael Fesser

unread,
Oct 18, 2007, 9:41:54 PM10/18/07
to
.oO(Summercool)

>On Oct 18, 5:46 pm, Gary L. Burnore <gburn...@databasix.com> wrote:
>
>> > echo '$obj->arr[n*size][i-1]' . $obj->arr[n*size][i-1];
>>
>> >so you have to make sure both places are indeed the same expression --
>>
>> If that's too hard for you, perhaps you should consider a job in the
>> food or hospitality industry.
>
>so if PHP or people who are proficient in PHP cannot give a good
>solution to this simple thing

Simple? This:

$obj->arr[n*size][i-1]

is not a simple variable name - it's a complex expression! If you pass
that to the function, all the function receives is the result of that
expression, not its source code. If you want that - add it yourself as a
second parameter.

Micha

Summercool

unread,
Oct 18, 2007, 10:09:10 PM10/18/07
to
On Oct 18, 6:41 pm, Michael Fesser <neti...@gmx.de> wrote:
> .oO(Summercool)
>
> >On Oct 18, 5:46 pm, Gary L. Burnore <gburn...@databasix.com> wrote:
>
> >> > echo '$obj->arr[n*size][i-1]' . $obj->arr[n*size][i-1];
>
> >> >so you have to make sure both places are indeed the same expression --
>
> >> If that's too hard for you, perhaps you should consider a job in the
> >> food or hospitality industry.
>
> >so if PHP or people who are proficient in PHP cannot give a good
> >solution to this simple thing
>
> Simple? This:
>
> $obj->arr[n*size][i-1]


a few other languages I know can make this possible. in the PHP group
I usually hear "don't compare PHP to other languages". or "no, you
don't really need that." oh well, if this is the way it is, so be it.


Jerry Stuckle

unread,
Oct 18, 2007, 10:25:10 PM10/18/07
to

You don't get it, do you? Other languages generally do NOT make this
possible. The debuggers they have may, though.

And there are PHP debuggers, also.

Summercool

unread,
Oct 18, 2007, 10:30:54 PM10/18/07
to
On Oct 18, 7:25 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> Summercool wrote:
> > On Oct 18, 6:41 pm, Michael Fesser <neti...@gmx.de> wrote:
> >> .oO(Summercool)
>
> >>> On Oct 18, 5:46 pm, Gary L. Burnore <gburn...@databasix.com> wrote:
> >>>>> echo '$obj->arr[n*size][i-1]' . $obj->arr[n*size][i-1];
> >>>>> so you have to make sure both places are indeed the same expression --
> >>>> If that's too hard for you, perhaps you should consider a job in the
> >>>> food or hospitality industry.
> >>> so if PHP or people who are proficient in PHP cannot give a good
> >>> solution to this simple thing
> >> Simple? This:
>
> >> $obj->arr[n*size][i-1]
>
> > a few other languages I know can make this possible. in the PHP group
> > I usually hear "don't compare PHP to other languages". or "no, you
> > don't really need that." oh well, if this is the way it is, so be it.
>
> You don't get it, do you? Other languages generally do NOT make this
> possible. The debuggers they have may, though.
>
> And there are PHP debuggers, also.


that's not true. The other languages don't need a debugger to make
this possible.

Jerry Stuckle

unread,
Oct 18, 2007, 10:33:57 PM10/18/07
to

For instance - in C, there is no way to display a variable. It is
strictly the debugging tools which make it work.

Or, I challenge you to show me ANYWHERE in the ANSI C spec that this
should be possible. It doesn't exist.

It is strictly a result of the debugging tools in the compiler.

And I did not say you had to have a debugger. I said debugging tools.
There is a difference!

Message has been deleted
Message has been deleted
Message has been deleted

Summercool

unread,
Oct 18, 2007, 10:43:20 PM10/18/07
to


you can use #define in C to do that. it is in the pre-compiler.

macca

unread,
Oct 18, 2007, 10:45:33 PM10/18/07
to
>I wonder in PHP, can you have a function like

> print_debug($foo);

>and it will print out:

>$foo is:
>3


<?php

//============ Function : print_debug( arr result of get_defined_vars,
mixed variable to debug)


function print_debug($defined_vars_array, $debug){

$unset_unwanted =
array("GLOBALS","_POST","_GET","_COOKIE","_FILES");
foreach ($unset_unwanted as $remove){
unset($defined_vars_array[$remove]);
}


while ($element = current($defined_vars_array)) {
if ($element == $debug) {

if (is_array($debug)){
echo '$'.key($defined_vars_array).' = <br />'.
print_r($debug, TRUE) . "<br />";
} else {
echo '$'.key($defined_vars_array).' = '. $debug . "<br />";
}
}
next($defined_vars_array);
}
}


//============= End of Function

//=========================================
// somescript.php


// Test Variable
$test_var1 = "This is a test Variable";
$var_test = array(1,2,3);

// debug the variable by calling "print_debug()"

$arr = get_defined_vars();
print_debug($arr,$var_test);


?>

Prints

$var_test =
Array ( [0] => 1 [1] => 2 [2] => 3 )


You get the point. Im off to bed.

Summercool

unread,
Oct 18, 2007, 10:58:27 PM10/18/07
to


The above code doesn't seem to print anything out...
it is mainly to compare values? then what if two variables have the
same content? can it distinguish which is which?


Message has been deleted

macca

unread,
Oct 18, 2007, 11:38:05 PM10/18/07
to

> The above code doesn't seem to print anything out...
> it is mainly to compare values? then what if two variables have the
> same content? can it distinguish which is which?

I just wrote this now to give you an idea of how you could do this
thing... if i had two identical values...

$f = 2;
$h = 2;

and I pass it one, say $f (i.e. 2)

$arr = get_defined_vars();
print_debug($arr,$f);

it prints out:

$f = 2
$h = 2


as its the *value* being passed into the function. Seems to compare
values pretty well to me.


The point is, where theres a will theres a way. I came up with this in
a few munutes, i bet there would be some way to refine it given a
little more time and a little less squabbling...

or

just go with Jerry Stuckles method...its a lot easier.

Summercool

unread,
Oct 19, 2007, 12:58:34 AM10/19/07
to
On Oct 18, 8:38 pm, macca <ptmcna...@googlemail.com> wrote:
>
> just go with Jerry Stuckles method...its a lot easier.


look, i got 20 variables and complicated expressions to print out. it
is for experimentation and not for production. if there is an elegant
solution, fine. the recommendations here seems to be "there is no
need", "why you want to do that?", "if you cannot copy and paste code,
go flip burgers." bravo.


macca

unread,
Oct 19, 2007, 5:54:28 AM10/19/07
to
Some people just dont appreciate it when you try to help them. Well
I'm not gonna waste any more time on this then...huh.

Jerry Stuckle

unread,
Oct 19, 2007, 7:47:45 AM10/19/07
to

Yes, it is. But it doesn't produce the output you're looking for. All
that does is create a macro - which expands to exactly what everyone
else was telling you to do.

No difference.

Jerry Stuckle

unread,
Oct 19, 2007, 7:49:02 AM10/19/07
to

The recommendation here is for you to get into the hospitality or
service industry. You're obviously not cut out to be a programmer.

Jerry Stuckle

unread,
Oct 19, 2007, 7:49:54 AM10/19/07
to
Gary L. Burnore wrote:

> On Thu, 18 Oct 2007 22:25:10 -0400, Jerry Stuckle
> <jstu...@attglobal.net> wrote:
>
>> Summercool wrote:
>>> On Oct 18, 6:41 pm, Michael Fesser <neti...@gmx.de> wrote:
>>>> .oO(Summercool)
>>>>
>>>>> On Oct 18, 5:46 pm, Gary L. Burnore <gburn...@databasix.com> wrote:
>>>>>>> echo '$obj->arr[n*size][i-1]' . $obj->arr[n*size][i-1];
>>>>>>> so you have to make sure both places are indeed the same expression --
>>>>>> If that's too hard for you, perhaps you should consider a job in the
>>>>>> food or hospitality industry.
>>>>> so if PHP or people who are proficient in PHP cannot give a good
>>>>> solution to this simple thing
>>>> Simple? This:
>>>>
>>>> $obj->arr[n*size][i-1]
>>>
>>> a few other languages I know can make this possible. in the PHP group
>>> I usually hear "don't compare PHP to other languages". or "no, you
>>> don't really need that." oh well, if this is the way it is, so be it.
>>>
>>>
>>>
>> You don't get it, do you? Other languages generally do NOT make this
>> possible. The debuggers they have may, though.
>>
>> And there are PHP debuggers, also.
>
> What'cha wanna bet he leaves the code in debug mode in prod?

No bets here, Gary. :-)

Kye

unread,
Oct 19, 2007, 8:05:07 AM10/19/07
to
>> What'cha wanna bet he leaves the code in debug mode in prod?
>
> No bets here, Gary. :-)

For the newbies... Theres a debug mode for code?

--
Yours Sincerely
Kye


Jerry Stuckle

unread,
Oct 19, 2007, 8:18:58 AM10/19/07
to
Kye wrote:
>>> What'cha wanna bet he leaves the code in debug mode in prod?
>> No bets here, Gary. :-)
>
> For the newbies... Theres a debug mode for code?
>

That typically means you've added some code for debugging problems.

There are settings in your php.ini file which should be different
between development and production systems (i.e. display_errors), and
some debug functions. And there are external debuggers.

But there isn't a "debug mode" in the way you're thinking.

Kye

unread,
Oct 19, 2007, 8:28:03 AM10/19/07
to
> That typically means you've added some code for debugging problems.
>
> There are settings in your php.ini file which should be different between
> development and production systems (i.e. display_errors), and some debug
> functions. And there are external debuggers.
>
> But there isn't a "debug mode" in the way you're thinking.

Would this include the classic things like mysql_error like in the below?

$result = mysql_query($query) or die ('Error in query: $query. '
.mysql_error());

--
Yours Sincerely
Kye


Jerry Stuckle

unread,
Oct 19, 2007, 8:51:21 AM10/19/07
to

Yes, I would never use die() or display database error messages in
production code.

Message has been deleted

Jerry Stuckle

unread,
Oct 19, 2007, 12:00:29 PM10/19/07
to
Gary L. Burnore wrote:

> On Fri, 19 Oct 2007 08:51:21 -0400, Jerry Stuckle
> <jstu...@attglobal.net> wrote:
>
>> Kye wrote:
>>>> That typically means you've added some code for debugging problems.
>>>>
>>>> There are settings in your php.ini file which should be different between
>>>> development and production systems (i.e. display_errors), and some debug
>>>> functions. And there are external debuggers.
>>>>
>>>> But there isn't a "debug mode" in the way you're thinking.
>>> Would this include the classic things like mysql_error like in the below?
>>>
>>> $result = mysql_query($query) or die ('Error in query: $query. '
>>> .mysql_error());
>>>
>> Yes, I would never use die() or display database error messages in
>> production code.
>
> Agreed. And while he likely does these things too, I was referring to
> his comment about printing variables in C. Leaving preprocsessor
> warnings enabled in production.
>

Ah, thanks for the clarification.

Michael Fesser

unread,
Oct 20, 2007, 12:38:59 PM10/20/07
to
.oO(Summercool)

>On Oct 18, 6:41 pm, Michael Fesser <neti...@gmx.de> wrote:
>> .oO(Summercool)
>>

>> >so if PHP or people who are proficient in PHP cannot give a good
>> >solution to this simple thing
>>
>> Simple? This:
>>
>> $obj->arr[n*size][i-1]
>
>
>a few other languages I know can make this possible.

Name at least two of them, which allow to print the complex expression
(not only a single variable) passed as an argument to a function.

Micha

kenneth02394832

unread,
Oct 21, 2007, 1:13:09 AM10/21/07
to


See, Jerry Stuckle, if you are not that good, stop sounding like you
are good. The C preprocessor can do it, by something that's called
Stringification.

http://www.google.com/search?hl=en&q=C+Stringification&btnG=Google+Search

Don't know about it, DO YOU? Since you are not as good as me, why
don't you go work for the hospitality or service industry? But sorry,
you are not that hospitable either.


kenneth02394832

unread,
Oct 21, 2007, 1:16:31 AM10/21/07
to
On Oct 19, 4:49 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> Summercool wrote:
> > On Oct 18, 8:38 pm, macca <ptmcna...@googlemail.com> wrote:
> >> just go with Jerry Stuckles method...its a lot easier.
>
> > look, i got 20 variables and complicated expressions to print out. it
> > is for experimentation and not for production. if there is an elegant
> > solution, fine. the recommendations here seems to be "there is no
> > need", "why you want to do that?", "if you cannot copy and paste code,
> > go flip burgers." bravo.
>
> The recommendation here is for you to get into the hospitality or
> service industry. You're obviously not cut out to be a programmer.

If you, Jerry, Stuckle, cannot provide a good solution, that doesn't
mean someone else should go work for a different industry. Maybe you
are smart enough to know that. Maybe not.


kenneth02394832

unread,
Oct 21, 2007, 1:26:22 AM10/21/07
to

C and Ruby can both do it.
C is by something that's call Stringification. Google it. For Ruby,
look for the Ruby Forum.


kenneth02394832

unread,
Oct 21, 2007, 1:48:41 AM10/21/07
to

a search for "Jerry Stuckle" on Google Groups:

http://groups.google.com/groups/search?q=jerry+stuckle&qt_s=Search+Groups

the lines

Jerry Stuckle - Fat, Old, Talentless, Unproducing and Stupid

PUNCHING JERRY STUCKLE IN THE FACE

come up quite often...


Jerry Stuckle

unread,
Oct 21, 2007, 10:12:39 AM10/21/07
to

Oh, I know about it, all right. Every one of those examples is a MACRO
- just as I said. But you don't know the difference, do you?

And BTW - I suspect I've been teaching C programming longer than you've
been a programmer. From your updates, probably longer than you've been
alive.

Actually, the service or hospitality industry is beyond your grasp.
Maybe dishwasher would work.

Jerry Stuckle

unread,
Oct 21, 2007, 10:14:18 AM10/21/07
to

Yep, from trolls like you, Daniel Chandler.

Trolling other groups now? ROFLMAO!

You did catch me the first time. Then I had to check to find it is you
morphing again.

AnrDaemon

unread,
Oct 21, 2007, 10:30:51 AM10/21/07
to
Greetings, Jerry Stuckle.
In reply to Your message dated Sunday, October 21, 2007, 18:12:39,

JS> kenneth02394832 wrote:
>> On Oct 19, 4:47 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>>> Summercool wrote:
>>>> On Oct 18, 7:33 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>>>>> Summercool wrote:
>>>>>> On Oct 18, 7:25 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>>>>>>> Summercool wrote:
>>>>>>>> On Oct 18, 6:41 pm, Michael Fesser <neti...@gmx.de> wrote:
>>>>>>>>> .oO(Summercool)
>>>>>>>>>> On Oct 18, 5:46 pm, Gary L. Burnore <gburn...@databasix.com> wrote:

Mmm... Can You both please filter Your quoting?
TIA


--
Sincerely Yours, AnrDaemon <anrd...@freemail.ru>

Michael Fesser

unread,
Oct 21, 2007, 11:11:28 AM10/21/07
to
.oO(kenneth02394832)

It's done by the preprocessor for replacing arguments passed to a
_macro_. But a macro is not a function, which is what we're talking
about here.

Micha

Message has been deleted

Summercool

unread,
Oct 24, 2007, 1:53:13 AM10/24/07
to
On Oct 21, 7:12 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>
> Oh, I know about it, all right. Every one of those examples is a MACRO
> - just as I said. But you don't know the difference, do you?

You thought it was impossible. And now you are saying "Macro blah
blah blah"? What a loser.

Jerry Stuckle - Fat, Old, Talentless, Unproducing and Stupid

is indeed true.


the_case_...@yahoo.co.uk

unread,
Dec 5, 2007, 1:06:19 PM12/5/07
to
This simple solution is from 2003:

http://www.devnetwork.net/forums/viewtopic.php?p=65222

It works.

Summercool

unread,
Jan 24, 2008, 5:23:53 AM1/24/08
to

for people following this thread. the URL seems to be updated to

http://forums.devnetwork.net/viewtopic.php?p=65222

and here is the content:

<?php
function print_var($varname)
{
global ${$varname};
echo $varname, ': ', ${$varname};
}

$foo = (int)123;
print_var('foo');
?>


Summercool

unread,
Jan 24, 2008, 5:30:35 AM1/24/08
to
On Jan 24, 2:23 am, Summercool <Summercooln...@gmail.com> wrote:
>
> for people following this thread.  the URL seems to be updated to
>
> http://forums.devnetwork.net/viewtopic.php?p=65222

and it seems to work for some cases but not all:

<?


function print_var($varname)
{
global ${$varname};

echo $varname, ': ';
print_r(${$varname});
echo "\n";
}

$foo = 123;
print_var('foo');
$bar = 123;
print_var("bar");
$far = array(1,3,5);
print_var("far");
print_var('far[1]');

?>

$ php try.php
foo: 123
bar: 123
far: Array
(
[0] => 1
[1] => 3
[2] => 5
)

far[1]:

so the last one didn't work

sendto...@gmail.com

unread,
Sep 9, 2016, 11:23:58 AM9/9/16
to
On Thursday, October 18, 2007 at 8:03:54 PM UTC-4, Rik Wasmus wrote:
> On Fri, 19 Oct 2007 01:52:42 +0200, Summercool <Summerc...@gmail.com>
> wrote:
>
> > I wonder in PHP, can you have a function like
> >
> > print_debug($foo);
> >
> > and it will print out:
> >
> > $foo is:
> > 3
> >
> > that is, it will print out, most importantly, the variable name, as
> > well as its content.
> >
>
> No, as it's name should be of utter unimportance.
>
> (Somewhere in this group there's been given a 'solution' for this about a
> year ago I think. It involved using debug_backtrace(), fopen()ing the file
> and reading/parsing the line indicated in that array. Not anything you
> should want to do.)
>
> As said, the variable name should be of no importance. If you're trying to
> pinpoint changes in your script you can either use __FILE__ & __LINE__
> along with the output, of use the debug_backtrace() mentioned earlier in a
> function to output the file & line it was called.
> --
> Rik Wasmus

This may be true in most cases, but I'm running into this situation now. It's a situation whereby I'm grabbing field names from a database and assigning them to a variable $X. I need to see as I pass through each field if it's giving the $X variable the name of each field as it's variable name. I'm trying to dynamically create variables based on those field names. I've done this, I think...but I need to test it. Simply doing an ECHO '$X'; only shows me "$X," which means what?...that it's not working or that it's simply treating ECHO '$X' as an explicit vs the actual variable name?

R.Wieser

unread,
Sep 9, 2016, 11:53:49 AM9/9/16
to
Robert (if thats your name),

First off, that message you're responding to is 9 *years* old. I don't
think that Rik will still be waiting for an answer (this "lets 'necrobump' "
seems to be a Google forums problem only).

Second: your question has got very little (read: nothing) to do with his
problem.

So, next time when you have a problem do not tack it on a ( very) old
message with a different problem, but post it on its own

As for your problem ?

#1: $X is *NOT* text. So, why are you encolosing it in (single)quotes ?

#2: AFAIK single-quotes around a string prohibit PHP from interpreting its
contents and replacing eventually embedded PHP variables with their
contents.
So, if you *have* to use quotes (which you, in this example, do not), use
double-instead of single-quotes.

Regards,
Rudy Wieser


-- Origional message:
<sendto...@gmail.com> schreef in berichtnieuws
3aa14ac8-7d76-4fe2...@googlegroups.com...
0 new messages