Recent Topics

1 Sep 11, 2006 21:05    

Ok here is another thing i'm curious about.

I have this class;

class myClass {
function display_page1(){
  // lots of html goes here

function display_page2(){
  // we include page2 which contains lots of html
  include 'page2.php';

You would think that display_page2 would be better design, as with display_page1 all that code goes into memory where it may not even be needed. However with display_page2 the memory is only loaded when 'page2.php' is included.

So your say?

2 Sep 12, 2006 00:01

IIRC, PHP used to include everything that it found (like your include above). But that's probably not true for PHP5 and therefor a several include is better, because it does not need to get parsed (memory is not really an issue). Also parsing not. E.g., if you would close the PHP tag, put the HTML there and open the PHP tag again at the end of the function, there's nearly no memory overhead, except during reading the file, of course.

Just my 0.02$ - you probably want to get the real info somewhere nearer at the source.. ;) (and report it here)

Form is loading...

Social CMS software – This forum is powered by b2evolution CMS, a complete engine for your website.