Forum Moderators: coopster

Message Too Old, No Replies

Maximum Size on PHP array's?

errors working with large arrays

         

Mody550

10:21 pm on Oct 8, 2002 (gmt 0)

10+ Year Member



I have been developing a simple content management system for a website. I have a script that goes to the page I want to updated, pulls the text within the designated tagged areas and stores it in an array ($textArea[0]). Everything works well until I was trying to update a large amount of content. When I go and run the script I get an "The page cannot be displayed" error. I have tried looking to see if there is a maximum size on arrays, but have been unable to find any answers. Here is the code I have been using.

<?
// Read in index.htm as string
$filename = "/vol/drive2/sites/site9/web/CTV/index.html";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);

//Parse out needed text area
preg_match("/<!--\s*Begin\s*Content\s*-->\s*\w*(.¦\n)*<!--\s*End\s*Content\s*-->/", $contents, $textArea);

// Remove slashes
// Delete this line when config is changed
$textArea[0] = stripslashes($textArea[0]);

// Remove HTML comments
$textArea[0] = str_replace("<!-- Begin Content -->","",$textArea[0]);
$textArea[0] = str_replace("<!-- End Content -->","",$textArea[0]);

// Convert all standard and XHTML-compliant tags to newlines
$textArea[0] = eregi_replace('<br[[:space:]]*/?[[:space:]]*>', "\n", $textArea[0]);
?>

If there is a max size on arrays, What is it? Is there a way around this problem? Thanks.

jatar_k

4:39 pm on Oct 15, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld [webmasterworld.com] Mody550

did you figure out your problem on this yet? I would think it wouldn't be an array size problem but, more likely, how the data is being handled or displayed.

Mody550

4:52 pm on Oct 15, 2002 (gmt 0)

10+ Year Member



No, I have still not found an answer to my problem. I have had to just take out the current functionality of reading in the text from the selected area. While I don't really believe it is an array or string problem, test after test shows that if I read in to much text the script fails. I don't really get it but I am a very inexperienced at php and am talking to other programmers to see if I can find a solution. Thanks.