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
https://forums.phpfreaks.com/topic/83027-solved-speed-of-loading-a-php-page/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.