Php 5 and mysql

Php 5 and mysql

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

 

You are here: MYSQL Database >>Php 5 and mysql

Php 5 and mysql article lists.

Php 5 and mysql

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 5 and mysql Related Links
Php mysql iisPhp mysql blog
Php mysql cmsPhp mysql invoice
Hebergeur php mysqlMysql package php
Php mysql avec dream weaver mxPhp mysql cart
Parent and child recursive php mysqlFile mysql php upload
Backup mysql databaseMysql sample database
Unlimited mysql databaseDelete database mysql
Creating mysql databaseCreate database in mysql
Mysql database designCopy mysql database
Convert access database to mysqlMysql database software
Restore database mysqlDatabase dump mysql
Database mysql serverMysql database tutorial
Computer software database mysqlDownload mysql database
Import mysql databaseHow to set up mysql database
How to rename mysql databaseAdministration database mysql
Mysql database setupMysql download window
Mysql front downloadDownload mysql tutorial
Download mysql serverFree mysql tutorial
Mysql asp tutorialMysql beginner tutorial
Tutorial de mysqlMysql front end
Mysql front 2.5Mysql front free
Free gui for mysqlMysql gui client
Mysql admin toolMysql odbc 3.51 driver
Free host mysql webFree mysql server
Internet and questionnaire and free and mysqlFree mysql tool
 
©2005 All Rights Reserved   MYSQL Database