Warning: Function get_magic_quotes_gpc() is deprecated in /home/admins/public_html/includes/class_core.php on line 1960

Warning: Array and string offset access syntax with curly braces is deprecated in ..../includes/functions.php on line 865

Warning: Array and string offset access syntax with curly braces is deprecated in ..../includes/functions.php on line 1303

Warning: Array and string offset access syntax with curly braces is deprecated in ..../includes/functions.php on line 4422

Warning: Array and string offset access syntax with curly braces is deprecated in ..../includes/functions.php on line 7349

Warning: Methods with the same name as their class will not be constructors in a future version of PHP; vBulletinHook has a deprecated constructor in ..../includes/class_hook.php on line 27

Warning: Methods with the same name as their class will not be constructors in a future version of PHP; vB_XML_Parser has a deprecated constructor in ..../includes/class_xml.php on line 52

Warning: Methods with the same name as their class will not be constructors in a future version of PHP; vB_XML_Builder has a deprecated constructor in ..../includes/class_xml.php on line 689
ࡱ> ;=:Y l$bjbj ..\\H#FF8  d02HHHH###$J"V ##### HHCCC#HHC#CCkH`O<40d"!"""(##C#####  C###d####"#########F> :  HYPERLINK "http://www.adminspoint.com/php/177-50-php-server-side-scripting-language-tips-tricks.html" http://www.adminspoint.com/php/177-50-php-server-side-scripting-language-tips-tricks.html echo is faster than print. Wrap your string in single quotes () instead of double quotes () is faster because PHP searches for variables inside and not in , use this when youre not using variables you need evaluating in your string. Use sprintf instead of variables contained in double quotes, its about 10x faster. Use echos multiple parameters (or stacked) instead of string concatenation. Use pre-calculations, set the maximum value for your for-loops before and not in the loop. ie: for ($x=0; $x < count($array); $x), this calls the count() function each time, use $max=count($array) instead before the for-loop starts. Unset or null your variables to free memory, especially large arrays. Avoid magic like __get, __set, __autoload. Use require() instead of require_once() where possible. Use full paths in includes and requires, less time spent on resolving the OS paths. require() and include() are identical in every way except require halts if the file is missing. Performance wise there is very little difference. Since PHP5, the time of when the script started executing can be found in $_SERVER[REQUEST_TIME], use this instead of time() or microtime(). PCRE regex is quicker than EREG, but always see if you can use quicker native functions such as strncasecmp, strpbrk and stripos instead. When parsing with XML in PHP try xml2array, which makes use of the PHP XML functions, for HTML you can try PHPs DOM document or DOM XML in PHP4. str_replace is faster than preg_replace, str_replace is best overall, however strtr is sometimes quicker with larger strings. Using array() inside str_replace is usually quicker than multiple str_replace. else if statements are faster than select statements aka case/switch. Error suppression with @ is very slow. To reduce bandwidth usage turn on mod_deflate in Apache v2 or for Apache v1 try mod_gzip. Close your database connections when youre done with them. $row[id] is 7 times faster than $row[id], because if you dont supply quotes it has to guess which index you meant, assuming you didnt mean a constant. Use tags when declaring PHP as all other styles are depreciated, including short tags. Use strict code, avoid suppressing errors, notices and warnings thus resulting in cleaner code and less overheads. Consider having error_reporting(E_ALL) always on. PHP scripts are be served at 2-10 times slower by Apache httpd than a static page. Try to use static pages instead of server side scripts. PHP scripts (unless cached) are compiled on the fly every time you call them. Install a PHP caching product (such as memcached or eAccelerator or Turck MMCache) to typically increase performance by 25-100% by removing compile times. You can even setup eAccelerator on cPanel using EasyApache3. An alternative caching technique when you have pages that dont change too frequently is to cache the HTML output of your PHP pages. Try Smarty or Cache Lite. Use isset where possible in replace of strlen. (ie: if (strlen($foo) < 5) { echo Foo is too short; } vs. if (!isset($foo{5})) { echo Foo is too short; } ). ++$i is faster than $ i++, so use pre-increment where possible. Make use of the countless predefined functions of PHP, dont attempt to build your own as the native ones will be far quicker; if you have very time and resource consuming functions, consider writing them as C extensions or modules. Profile your code. A profiler shows you, which parts of your code consumes how many time. The Xdebug debugger already contains a profiler. Profiling shows you the bottlenecks in overview. Document your code. Learn the difference between good and bad code. Stick to coding standards, it will make it easier for you to understand other peoples code and other people will be able to understand yours. Separate code, content and presentation: keep your PHP code separate from your HTML. Dont bother using complex template systems such as Smarty, use the one thats included in PHP already, see ob_get_contents and extract, and simply pull the data from your database. Never trust variables coming from user land (such as from $_POST) use mysql_real_escape_string when using mysql, and htmlspecialchars when outputting as HTML. For security reasons never have anything that could expose information about paths, extensions and configuration, such as display_errors or phpinfo() in your webroot. Turn off register_globals (its disabled by default for a reason!). No script at production level should need this enabled as it is a security risk. Fix any scripts that require it on, and fix any scripts that require it off using unregister_globals(). Do this now, as its set to be removed in PHP6. Avoid using plain text when storing and evaluating passwords to avoid exposure, instead use a hash, such as an md5 hash. Use ip2long() and long2ip() to store IP addresses as integers instead of strings. You can avoid reinventing the wheel by using the PEAR project, giving you existing code of a high standard. When using header(Location: .$url); remember to follow it with a die(); as the script continues to run even though the location has changed or avoid using it all together where possible. In OOP, if a method can be a static method, declare it static. Speed improvement is by a factor of 4.. Incrementing a local variable in an OOP method is the fastest. Nearly the same as calling a local variable in a function and incrementing a global variable is 2 times slow than a local variable. Incrementing an object property (eg. $this->prop++) is 3 times slower than a local variable. Incrementing an undefined local variable is 9-10 times slower than a pre-initialized one. Just declaring a global variable without using it in a function slows things down (by about the same amount as incrementing a local var). PHP probably does a check to see if the global exists. Method invocation appears to be independent of the number of methods defined in the class because I added 10 more methods to the test class (before and after the test method) with no change in performance. Methods in derived classes run faster than ones defined in the base class. A function call with one parameter and an empty function body takes about the same time as doing 7-8 $localvar++ operations. A similar method call is of course about 15 $localvar++ operations. Not everything has to be OOP, often it is just overhead, each method and object call consumes a lot of memory. Never trust user data, escape your strings that you use in SQL queries using mysql_real_escape_string, instead of mysql_escape_string or addslashes. Also note that if magic_quotes_gpc is enabled you should use stripslashes first. Avoid the PHP mail() function header injection issue. Unset your database variables (the password at a minimum), you shouldnt need it after you make the database connection. RTFM! PHP offers a fantastic manual, possibly one of the best out there, which makes it a very hands on language, providing working examples and talking in plain English. Please USE IT!     www.Adminspoint.com  fhiF$G$H$I$K$L$N$O$Q$R$T$i$k$l$hkQjhkQU hFh6 CJOJPJQJaJh48h>h6 0J h6 h6 h6 jh6 U Z C @ a }JOL|A & Fddd[$\$gd6 gd6 !  CN r5{ !!"## & Fddd[$\$gd6 #F$G$H$J$K$M$N$P$Q$S$T$i$j$k$l$ dgd6 gd6  & Fddd[$\$gd6 ,1h/ =!"#$%  s666666666vvvvvvvvv666666>6666666666666666666666666666666666666666666666666hH66666666666666666666666666666666666666666666666666666666666666666p62&6FVfv2(&6FVfv&6FVfv&6FVfv&6FVfv&6FVfv&6FVfv8XV~ 0@ 0@ 0@ 0@ 0@ 0@ 0@ 0@ 0@ 0@ 0@ 0@ 0@ 0@ OJPJQJ_HmH nH sH tH J`J Normal dCJ_HaJmH sH tH DA D Default Paragraph FontRiR 0 Table Normal4 l4a (k ( 0No List 4@4 6 0Header  H$6/6 6 0 Header CharCJaJ4 4 6 0Footer  H$6/!6 6 0 Footer CharCJaJ6U@16 6 0 Hyperlink >*B*phcPK![Content_Types].xmlN0EH-J@%ǎǢ|ș$زULTB l,3;rØJB+$G]7O٭VvnB`2ǃ,!"E3p#9GQd; H xuv 0F[,F᚜K sO'3w #vfSVbsؠyX p5veuw 1z@ l,i!b I jZ2|9L$Z15xl.(zm${d:\@'23œln$^-@^i?D&|#td!6lġB"&63yy@t!HjpU*yeXry3~{s:FXI O5Y[Y!}S˪.7bd|n]671. tn/w/+[t6}PsںsL. J;̊iN $AI)t2 Lmx:(}\-i*xQCJuWl'QyI@ھ m2DBAR4 w¢naQ`ԲɁ W=0#xBdT/.3-F>bYL%׭˓KK 6HhfPQ=h)GBms]_Ԡ'CZѨys v@c])h7Jهic?FS.NP$ e&\Ӏ+I "'%QÕ@c![paAV.9Hd<ӮHVX*%A{Yr Aբ pxSL9":3U5U NC(p%u@;[d`4)]t#9M4W=P5*f̰lk<_X-C wT%Ժ}B% Y,] A̠&oʰŨ; \lc`|,bUvPK! ѐ'theme/theme/_rels/themeManager.xml.relsM 0wooӺ&݈Э5 6?$Q ,.aic21h:qm@RN;d`o7gK(M&$R(.1r'JЊT8V"AȻHu}|$b{P8g/]QAsم(#L[PK-![Content_Types].xmlPK-!֧6 0_rels/.relsPK-!kytheme/theme/themeManager.xmlPK-!R%theme/theme/theme1.xmlPK-! ѐ' theme/theme/_rels/themeManager.xml.relsPK] l. """""%l$#l$hlX8@0(  B S  ?T]}=H  * /     x E J h n q s y  hnZi)nqVXps,4pxC[h{HJKMNPQSTjm@H%}KOPT Y`oqHJKMNPQSTjm33333333333333333333GHThm #b^`.^`.pp^p`.@ @ ^@ `.^`.^`.^`.^`.PP^P`. #OG6 48kQFHJ@l@UnknownG.Cx Times New Roman5Symbol3. *Cx Arial7.@CalibriA$BCambria Math"1hy8383!0::JQHP  $PF2!xx  Afeef Aneeq Afeef Aneeq Oh+'0t  0 < HT\dl Afeef Aneeq Normal.dotm Afeef Aneeq2Microsoft Office Word@^в@(@FG8՜.+,D՜.+,, hp|  3:  Title4 8@ _PID_HLINKSA[Zhttp://www.adminspoint.com/php/177-50-php-server-side-scripting-language-tips-tricks.html  !"#$%&'()+,-./013456789<Root Entry F0O>1Table"WordDocument..SummaryInformation(*DocumentSummaryInformation82CompObjr  F Microsoft Word 97-2003 Document MSWordDocWord.Document.89q