php require class call from inside method

Posted by jera on Stack Overflow See other posts from Stack Overflow or by jera
Published on 2010-05-02T23:50:24Z Indexed on 2010/05/02 23:57 UTC
Read the original article Hit count: 213

Filed under:
|
|
|
|

from my understanding, require pastes code into the calling php file.

what if you were requiring from inside a method...it would paste the entire code/class inside the method, blocking the next statement in the method.

eg.

  function test() {

    require 'pathtosomeclasscode';
    somestatement; // any code after the require is blocked.

 }

how do i get around this, to be able to require code where-ever, without it being pasted in that exact spot?

Thanks in advance for your help.

© Stack Overflow or respective owner

Related posts about php

Related posts about require