Page 1 of 2
PHP Optimization
Posted: Tue Apr 13, 2004 2:39 pm
by Chris Corbyn
Is anyone willing to provide a short list of hints and tips to keep your PHP scripts running as fast and reliably as possible?
Posted: Tue Apr 13, 2004 2:49 pm
by PrObLeM
tip1:
echo '';
is faster than
print "";
tip 2:
Dont use sloppy code
tip 3:
dont do something more than once (ie assigning variables, unessicary db connects ect)
tip 4
tip 5: profit
thoes are all the ones i can think of right now...im sure i have more
How to..
Posted: Tue Apr 13, 2004 3:17 pm
by Roja
Posted: Tue Apr 13, 2004 3:25 pm
by Chris Corbyn
Does anyone know if reducing the number of echo's is faster or sloppier?
For example:
Code: Select all
echo '<table>';
echo '<tr>';
echo '<td>';
echo 'Some text';
echo '</td>';
echo '</tr>';
echo '</table>';
compared to
Code: Select all
echo '<table>
<tr>
<td>
Some text
</td>
</tr>
</table>';
Posted: Tue Apr 13, 2004 3:28 pm
by Chris Corbyn
Oh and another question....
When I'm writing my php code I just use windows notepad. It's not particularly friendley for debbugging even when the code is nicely laid out.
On this forums php code is shown nicely color coded which makes things easier.
Anyone know of any software which lets you write your php so that it's viewable in color coded form like on this forum?
Posted: Tue Apr 13, 2004 3:39 pm
by piccaso
im using Macromedia Dreamweaver MX 2004, its qite nice but not free.
Im sure you will find something usefull here
http://www.thelinuxconsultancy.co.uk/ph ... /index.php
Posted: Tue Apr 13, 2004 3:49 pm
by Deemo
to d11wtq...
there is a whole discussion on editors in the general discussion section, look at that
Posted: Tue Apr 13, 2004 3:50 pm
by MarK (CZ)
I use ActiveState Komodo (
http://www.activestate.com/). Paid, but good.
Anyway, you can highlight the code using php via functions highlight_file or highlight_string.
My editor
Posted: Tue Apr 13, 2004 4:16 pm
by ElKyle
I use Crimson Editor...free

Also has no shareware messages, just pure, unadultered, old-fashioned freeware.
Go to
http://www.crimsoneditor.com
Color-codes for many diff. types of code, including PHP, ASP, Perl, and HMTL. Defaults are diff. colors than this site or php.net uses, but those are adjustable. Also, it automatically indents all lines between { and }...good for those of us that don't want to take the time to manually indent.
Posted: Tue Apr 13, 2004 4:18 pm
by RadixDev
If you want a strong debuggin feature go with PhpEd
Posted: Tue Apr 13, 2004 4:35 pm
by mudkicker
I prefer Zend Studio.
http://www.zend.com
Posted: Tue Apr 13, 2004 4:43 pm
by John Cartwright
kazaa + nortons personal firewall 2004/anti virus = dreamweaver mx 2004

Posted: Tue Apr 13, 2004 4:47 pm
by mudkicker
Phenom wrote:kazaa + nortons personal firewall 2004/anti virus = dreamweaver mx 2004

psssst. be quiet

Posted: Tue Apr 13, 2004 4:52 pm
by Chris Corbyn
Crimson editor looks cool. Just got it. At least it's free and you can customize all the colors it uses. Works for a whole host of languages too.
I should check out some others before I recommend it over anything else but I have to say, for a freeware program its pretty nice
Posted: Tue Apr 13, 2004 5:34 pm
by mishal
d11wtq wrote:Does anyone know if reducing the number of echo's is faster or sloppier?
In some php references i read, the following ways is much faster than both of your ways because php will never spend time to parse them, e.g. :
Code: Select all
<?
some php codes ....
...
?>
<table>
<tr>
<td>Some text
</td>
</tr>
</table>
<?
some php codes
..
?>