Php mysql query

Php mysql query

Php Programe About Us Links Downloads Contact Us Terms of use SiteMap
Php mysql query
Php mysql query

 

You are here: Php Programe >>Php mysql query

Php mysql query article lists.

Php mysql query

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 query Related Links
Apache install php mysqlPhp mysql admin
Form php mysqlHow to php connect to mysql
Php mysql databasePhp mysql example
Apache mysql php windowPhp mysql login
Server php mysqlPhp and php or mysql
Php mysql installBook guest mysql php using
Free web space php mysqlBook guest mysql php
Php and mysql web developmentPhp mysql download
Linux apache mysql phpMysql networking php
Social networking software php mysqlMysql php search
Php mysql shopping cartFlash mysql php
Php mysql insertSearching with php and mysql
Update mysql phpCalendar php mysql
Dream weaver php mysqlHost mysql php
Xml mysql phpPhp mysql programming
Php mysql rpmFree sample php mysql system
Php mysql windowPhp mysql list table
Apache install mysql php windowBackup 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
 
©2005 All Rights Reserved   Php Programe