You are here: Re: print out variable name as well as its content « PHP Programming Language « IT news, forums, messages
Re: print out variable name as well as its content

Posted by Rik Wasmus on 10/19/07 00:03

On Fri, 19 Oct 2007 01:52:42 +0200, Summercool <Summercoolness@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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация