does <?php echo html ; ?> slow my site

Posted on 2007-12-06
Last Modified: 2008-02-01
Hi experts,

In a file called config.php  I have this variable:
$path_to_pics = 'can/forum/picture';

And in the rest of the site I replaced every picture:
<img src='can/forum/picture/rtl.gif' />
With :
<img src='<?php echo $path_to_pics ?>/rtl.gif' />

Is this going to affect the speed of my site or the use of the server?
If yes, what is the best way to deal with this?

Question by:uk1900
  • 3

Accepted Solution

TheHound earned 200 total points
ID: 20425704
It will hardly effect things. Maybe a few milliseconds here and there, but it shouldn't be noticeable unless your server is unusually slow.

LVL 21

Assisted Solution

nizsmo earned 150 total points
ID: 20425706
Should not, I use this myself, and with/without the path appending with the PHP, I do not notice any loading time differences (tried testing it once or twice, and no time differences).

Expert Comment

ID: 20425711
By the way, it will do you more good than bad anyway because if you ever changed a directory, you just need to change one variable.
LVL 25

Assisted Solution

imitchie earned 150 total points
ID: 20425713
Not by any noticeable amount.  Check out free php websites like drupal, phpbb or joomla - there are a hundred times more complex and has many more $references!

Expert Comment

ID: 20425738
What imitchie said is quite true. Think of forums software such as IPB. They have thousands of lines of PHP code just like yours, and it takes under a second.

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
php convert date format 3 21
How would I do a website like this? 5 53
Using javascript confirmation for a delete in mysql 5 29
MySql and Apache/PHP Error Reporting 2 25
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now