hi, normally when we do programming. It is best that we get each php file to do different functions right? Like extract.php to extract data, search.php to search for things. In the end, how do you guys normally link those files together? i am using alot of require(); in my index.php file, don't really know if its a best practice. Do you guys put all the require() file on the top? i am putting them everywhere in my code when i need it. am i doing the right thing?
Using require or require_once on the right places can indeed speed up your scripting.. coz it will be only executed when needed.
php html - whatever you require I think the main difference between an include and require is the error handling
I give you an example how to do embed the script inside the script 1. main.php <?php require("sub.php"); echo $cal; ?> 2. sub.php <?php $cal=3+4; ?> This was a really simple example for a really simple php question.. please remeber if you using: 1. right syntax 2. right path ( if sub.php is located in another folder ) 3. using right php tags 4. correct file name (sub.php) if yes, then it should work.