You are here: Re: show array name « PHP Programming Language « IT news, forums, messages
Re: show array name

Posted by Chung Leong on 10/30/06 04:00

hygum wrote:
> is there a function, that can echo/print the name of an array, so when
> i dump the array, it also says the name? For instance:
>
> echo array_name($myarray);
>
> outputs:
> myarray

This question pops up every now and then. The answer is you can use
debug_backtrace() to get the source file and line number of the calling
function, from which you can then extract the variable name with
regexp. Not a foolproof technique and should only for debugging
purpose.

Do a search for debug_backtrace in this group and you should find a
working example I posted a few years ago.

 

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

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