Split a html code in two equal content parts, in PHP or JS?

You have to track the opened tags in a stack data structure. Then when you reach your split point, you have to close every tag that is on the stack in that exact order. The same for openening tags in the next string (in reverse order).

If you're going to use javascript, I would suggest welcome.totheinter.net/columnizer-jquery....

I am more interested in a php algorithm. 10x – Daniel May 28 '09 at 7:16 1 You should start with preg_split("/", $text, PREG_SPLIT_DELIM_CAPTURE); so that you have an array with text and html tags. Then parse the entire array, storing opened tags and closed ones (mind self closing tags ).

If $text is user input then you should watch out for things like foo, or foo and so on. Not so simple, but I did something similar writing a phpBB parser :) – MartinodF May 28 '09 at 13:27 thanks, I was just shearcing for something like that :) – Daniel Jun 3 '09 at 11:17.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions