Jump to content

[SOLVED] Speed of Loading a PHP Page


Northern Flame

Recommended Posts

i was just wondering if the number of lines in a PHP page

affect the speed in which the page loads? Obviously, a script

that does more will take longer to load, but do two scripts

that do the exact same thing, yet are written differently

have different loading times? And does white space matter

on the script? Heres an example of what I am talking about:

 

page1.php

<?php

/*
blah blah blah

blah blah blah
*/



$variable = 'test';





if($variable == 'testing'){

echo $variable;

}


elseif($variable == 'test'){

echo $variable;


}


else{

echo 'hello';


}


?>

 

page2.php

 

<?php
/*
comments
*/

$variable = 'test';

switch($variable){
case 'testing' || 'test':
echo $variable;
break;
default:
echo 'hello';
break;
}
?>

 

obviously those scripts do nothing but echo test,

but if it was a larger script and they were written

somewhat the same, would the loading times be

noticeably different?

 

P.S. if anyone is wondering why I am asking this question is because

there are a few websites I coded back that have a lot of white space

and can be shortened such as page1.php and now I have gotten

better at PHP and can re-code them to shorten them like page2.php

and I am wondering if it is worth doing.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.