Understanding print_r() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Understanding print_r() (/showthread.php?tid=35812) |
Understanding print_r() - El Forum - 11-11-2010 [eluser]tim042829[/eluser] I've written a little debug stub in vim for PHP variables. From the variable name, it expands to the following: Code: echo "<pre>foo: " . print_r($foo) . "</pre>"; ## DEBUG GLOBAL Code: $controller = BASEPATH.'codeigniter/CodeIgniter'.EXT; Quote:/home/http/php/ci/system/codeigniter/CodeIgniter.phpNote that controller: 1 is on a second line and tends to be a little confusing. The output that I am really looking for would be controller: /home/http/php/ci/system/codeigniter/CodeIgniter.php OR considering that I will be dealing with complex data structures: Quote:controller: 1 How can I make that happen? thanks tim Understanding print_r() - El Forum - 11-11-2010 [eluser]WanWizard[/eluser] Check the PHP manual for print_r(). You'll notice that it prints (echo's) the parameter, and returns true. Understanding print_r() - El Forum - 11-11-2010 [eluser]tim042829[/eluser] [quote author="WanWizard" date="1289530227"]Check the PHP manual for print_r(). You'll notice that it prints (echo's) the parameter, and returns true.[/quote] Are you referring to http://www.php.net/manual - link contained in the PHP man page? If so, I have yet to have found documentation for print_r() at that site. (but have found all kinds of other interesting and useful functions) If not, could you point me directly to the documentation? That would give me some more clues as to how find my way around. thanks tim Understanding print_r() - El Forum - 11-11-2010 [eluser]WanWizard[/eluser] Google "print_r". The first link returned is http://php.net/manual/en/function.print-r.php. Doesn't look to difficult. Understanding print_r() - El Forum - 11-11-2010 [eluser]tim042829[/eluser] Never mind. I found the documentation under Function Index. As http://www.php.net/manual/en/indexes.php => http://www.php.net/manual/en/function.print-r.php BTW: The expansion that works a little better for readability is Code: echo "<hr>foo: " ; print_r($foo); ## DEBUG GLOBAL Code: function! PHPGlobalDebug() Code: inoremap <C-d><C-g> <Esc>:call PHPGlobalDebug()<CR>A BTW: How did I get to be Grad Student? Heck, I'm still in first grade. |