Php mysql example

Php mysql example

MYSQL Database About Us Links Downloads Contact Us Terms of use SiteMap
Php mysql example
Php mysql example

 

You are here: MYSQL Database >>Php mysql example

Php mysql example article lists.

Php mysql example

5 tips for optimizing PHP




Rasmus Lerdorf, the inventor of PHP, recently headlined the PHPCon East 2003 show at the Park Central Hotel in New York City. Along with a keynote address, Lerdorf ran a session called “tips & tricks.” The following tip is taken from that session. To get additional tips from that session, please visit http://lerdorf.com/nytips.pdf.

 

 

5 tips for optimizing PHP

 

1) Don't use a regex if you don't have to, instead, use PHP’s string manipulation functions. For example:

 

BAD: <? $new = ereg_replace("-","_",$str); ?>

GOOD:<? $new = str_replace("-","_",$str); ?>

BAD: <? preg_match('/(\..*?)$/',$str,$reg);?>

GOOD:<? substr($str,strrpos($str,'.')); ?>

 

2) No references. Usually it is not faster to use references because of PHP's copy-on-write nature.

 

3) Use Persistent Database connections. Some databases are slower than others at establishing new connections, and the slower the database, the more of an impact using persistent connections will have. Keep in mind, however, that persistent connections will use resources even when not in use.

 

4) Take a look at MySQL unbuffered query. If you’re using MySQL, check out mysql_unbuffered_query(). You use it exactly like you would mysql_query(), the difference is that instead of waiting for the entire query to finish and storing the result in the client API, an unbuffered query makes results available as soon as possible and they are not allocated in the client API. You get access to your data quicker and use a lot less memory. But you can't use mysql_num_rows() on the result resource and it is likely to be slightly slower for small selects.

 

5) Keep it simple. Don't over-architect things. If your solution seems complex to you, there is probably a simpler and more obvious approach.

 

Copyright ?? 2005 Ziff Davis Media Inc. All Rights Reserved. Originally appearing in Publish.

Php mysql example Related Links
Script php mysqlApache mysql php window
Php mysql loginServer php mysql
Php and php or mysqlPhp mysql install
Book guest mysql php usingFree web space php mysql
Book guest mysql phpPhp and mysql web development
Php mysql downloadLinux apache mysql php
Mysql networking phpSocial networking software php mysql
Mysql php searchPhp mysql shopping cart
Flash mysql phpPhp mysql insert
Searching with php and mysqlUpdate mysql php
Calendar php mysqlDream weaver php mysql
Host mysql phpXml mysql php
Php mysql programmingPhp mysql rpm
Free sample php mysql systemPhp mysql window
Php mysql list tableApache install mysql php window
Free sample php mysql scriptBackup php mysql
Php mysql apache bundleOsting php mysql
Free sample php mysql generatePhp mysql learn
Mysql php portal wapApache mysql and php download
Host mysql php webReport mysql php
Cygwin apache mysql phpPhp mysql auction
Instalacion de php y mysqlMysql php using
Php mysql forumPhp mysql select
Php mysql softwarePhp 5 and mysql
Php mysql iisPhp mysql blog
 
©2005 All Rights Reserved   MYSQL Database