Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7166333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:23:47+00:00 2026-05-28T14:23:47+00:00

When you include or require a file in PHP, such as with the following,

  • 0

When you include or require a file in PHP, such as with the following, how much is actually transferred from the server?

index.php – 20kb, 10kb of which is HTML that would be a 10kb file if in its own HTML file.
./include/file.php – 30kb. Inside of file.php is HTML that would be 20kb’s worth of data if it was inside its own HTML file.
.javascript.js – 15kb

If index looks like this:

<?PHP 
 .... 
 // 10Kbs worth of stuff
 // links the JS file via <script> in the header
 require( './include/file.php' );
?>

How many bytes does the server transfer? I think the answer is that the server reads the PHP, so it accesses all 50kb’s (not the 15 for the JS), but it uploads and transfers the 10kb of HTML inside of the index file, the 20kb’s of HTML inside the included/file.php, and the JS at 15kb’s, totalling 45kb’s transferred.

Can someone confirm or show me the errors of my way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:23:48+00:00Added an answer on May 28, 2026 at 2:23 pm

    Require just includes a file. Nothing else.

    1. By require( './include/file.php' ); You are including code in the current file that resides in ./include/file.php. After that the resultant file will run. And the output of this file will be send to browser.
    2. The total size of the output is the content-length that will get downloaded.
    3. In require you pass a path to a file. This path can be remote(if you enable in php.ini) or local (as in example). If its a remote file, it’ll be downloaded to your server first for sure. But that doesn’t mean it’ll be downloaded to your client.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

php file to be available sitewide such that without require or include i simply
Is there any way to include php file using require and calling a php
Warning: include(/2008/2009/assets/inc/base/error.inc.php) [function.include]: failed to open stream: No such file or directory in C:\Program
I have a file that require()'s a namespace, as such: <?php require_once('Beer.php'); // This
Error: [2] require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory /var/www/vhosts/localhost/httpdocs/public.:./var/www/vhosts/localhost/httpdocs/public/../library:./var/www/vhosts/localhost/httpdocs/public/../model:.
Possible Duplicate: including php file from another server with php i want to have
I am trying to include the Zend_Service_Amazon_S3 file by using require_once 'Zend/Service/Amazon/S3.php'; I have
In my live site I have php include() and require() that have full path
In PHP: When should I use require vs. include ? When should I use
What should I use in the following statement? Include or required. if(a ==b){ require

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.