You are here: Re: print_r and large arrays « PHP Programming Language « IT news, forums, messages
Re: print_r and large arrays

Posted by Carl Vondrick on 03/08/06 06:57

meltdown wrote:
> Normally, if I use
> $result=print_r($array,TRUE);
> print_r prints nothing and $result is equal to the readable array.
>
> However, if $array is very large, print_r prints the array and returns
> nothing.
>
> Is this correct ? I don't see anything about this in the the manual.
>
> I have tried limiting the size to array to see exactly how large the
> array has to be to trigger this behavior, but the exact size seems to be
> variable or it depends on some other factor. Can anyone explain what is
> the deciding factor ?
You can use output buffering to get around this.

Just do:

ob_start();
print_r($array);
$value = ob_get_flush(); // or something like that!

I'm not sure why your problem is happening, but have you checked memory?
I bet it is a memory issue.

--
Carl Vondrick
www.carlsoft.net
usenet [at] carlsoft [dot] net

 

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

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