chantown Posted November 10, 2007 Share Posted November 10, 2007 I have a question about INCLUDING files. For example, let's say this file is FOOBAR.PHP: <?php class bar { function here.. //There are 10000 lines of code in this class function here. } foo = new bar(); ?> OK, so I have this FOOBAR.PHP I include. Let's say I don't even USE every function in foobar.php....I only use it for a couple functions, which total like 100 lines. Does that slow down my entire script if I include the whole file (because the PHP interpreter runs through 10000 lines of code?). Quote Link to comment Share on other sites More sharing options...
teng84 Posted November 10, 2007 Share Posted November 10, 2007 php only scan those code but it wont run those functions unless you call them Quote Link to comment Share on other sites More sharing options...
Barand Posted November 10, 2007 Share Posted November 10, 2007 It still has to read that file and then find those function declarations when they are called, but what overhead is incurred I don't know. Quote Link to comment Share on other sites More sharing options...
chantown Posted November 10, 2007 Author Share Posted November 10, 2007 right, it will scan it but will "scanning it" consume a lot? Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted November 10, 2007 Share Posted November 10, 2007 All I can tell ya is this... If there's a parse error in a function, the script will error out even if the function hasn't been called, and even if that function is at the bottom of a 1,000 function library, so... there you go. PHP reads every character of the script before it does anything else. What does it mean...? It means you'd have to do some benchmarking to make any sense of it. PhREEEk Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.