Affiliate Programs
 
Search affiliate programs for: 
Affiliate Categories
» Affiliate Networks
» Ad Networks
» 2-Tier Programs
» Pay Per Sale
» Contextual Ads
» Pay Per Lead
» Residual Income
» Datafeeds
» Multi-Tiered Programs
» Popups & Banner Ads
» Pay Per Click
» PPC Search Engines
» Business Opps
» Other Programs

Newsletter
Get newly added affiliate programs by email. Enter your email here:
Article Categories
» Affiliate Marketing
» Business
» Ecommerce
» Hosting
» Marketing
» Sales
» Web Designing
» Webmasters
» SEO & Promotion
» Working At Home
» Other Articles
» Affiliate Glossary


Go Back   AffiliateSeeking Forum > Website Creation, Design & Maintenance > Programming

Programming Get help with scripts, creating your website, general programming, etc.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-21-2008, 12:23 PM
platter007 platter007 is offline
Junior Member
 
Join Date: Aug 2008
Posts: 0
platter007 is on a distinguished road
Default PHP Tips And Tricks

PHP Tips And Tricks

File Access Optimization
When you need to including file, please recheck file content that will be use. If file is

not contains PHP codes, use readfile() function to increase performance.
Because files that including with readfile() does not parsing by PHP. It will be different

with construction language include() and require(), and files will be evaluated before.

Consequence from using readfile() is increase attack risk. This risk will be happen when

accessing file from URL.

Solution for the attack risk is by using File Handling.


Using echo
Echo allowed gives more than one string as parameter. Using some parameters are going to

more faster than blending some variables into a parameter.

$a = ‘Hello’;
$b = ‘Word’;
echo ‘Say ‘ .$a. ‘ to ‘ .$b’;
//more faster
echo ‘Say ‘ , $a, ‘ to ‘, $b’;


Checking string size

We usually using strlen() function to check the string size. The fast way to checking string

size is using isset().

if (strlen($str) <>
echo ‘String must be at least 5 chars’;
}

if (!isset($str{5})) {
echo ‘String must be at least 5 chars’;
}

isset() needs more little time than strlen() because isset() is construction language.


Avoid using Large String Concatenation
When do concatenation string, avoid uniting with large size string. It can obstructing code

execution that really can display more faster.

//large string concatenation
$title = ‘title’;
$body = ‘…a very large block…’;
echo “Subject: $title\n\n$body”;

//avoid large string concatenation
$title = ‘title’;
$body = ‘…a very large block…’;
echo “Subject: $title\n\n”;
echo $body;


Boolean data type
PHP is allowing to write Boolean data type with uppercase or lowercase. But, writing with

lowercase is more faster than uppercase. When found a constant, PHP do lookup hash constant

name.

if ($var = TRUE) {
...
}

//this is more faster
if ($var = true) {
...
}

When using a Boolean value, 1 and 0 are more faster than true and false.


Avoid space in your code
In this tip and trick, I’m going to explain how to make code optimization on your

application. The main purpose of this code optimization is to get more faster code

execution. The elementary key is by writing code effectively and efficiently. Because PHP

codes going to execute every time they are requested.

Avoid space in your code

Avoid using many spaces ( ) is a good thing. Every space is 1 byte and every tab (\t) is 1

byte. When you’re using four spaces, you’ve been use 4 bytes. It’s more effective if you’re

using a tab (\t).


Print Output
PHP is giving some sting functions to printing output into browser and we are often using

print() and echo() function. Both of those functions are not real function but a language

construction. print() and echo() function have same goal, but there are some essential

different that must to pay attention.

Print() function behavior like the other function in common and having return value integer

1. Thus, print() can used as part of expression which more complex. Meanwhile, echo() is

able to accept more than one parameters all at once, and does not having return value.

print() ‘string 1’;
echo ‘string 1’;
// using some parameters
echo ‘string 1’, “string 2”, ‘…’;

echo() function string will execution more faster than print(). This differentiate caused by

will return status (integer) which expose what process has done or not.

On the other side, echo() just displaying output only and do anything. At implementation,

return value status from using function string almost never needed.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-29-2008, 05:29 PM
mousee mousee is offline
Junior Member
 
Join Date: Aug 2008
Posts: 24
mousee is on a distinguished road
thanks for the tips. The last was unknown for me)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:13 AM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.0.0
© 2004-2008 AffiliateSeeking. All rights reserved.