How to speed up my site

Each and every single web site owner wants to see his/her website pages load faster than others but only some of them got it because its depend on server , network speed and mostly on programmer’s work strategy.An intelligent programmer always try to make site faster.Becasue when user surf a web site they want to run that faster and if site run slow than they switch to other site.The load time of websites is one of the most important factors affecting its usability; most Internet users will just skip a site altogether if it fails to load within a couple of seconds.

1. Optimize Images: always use Optimized images on a web page. Images represent the heavier load on virtually any website so make sure you are optimizing them. Alternatively you can also turn to an online image optimizer.When save image in an image editor try to save them with low resolution and save them using shift+ alt + ctrl +s for a web page.Even try to minimize image on a web page and make effect using css that will load the page faster.

Read the rest of this entry »

Difference between == and === operator

Both == and === are Compraison operators.

== check for equality of values

=== check equality as well as type of the operands means they should be equal and of same type.

For ex. 1==true means result is ture (both are equal)

but 1===true means result is false (both are equal but not same type)

Difference between htmlentities( ) and htmlspecialchars( ) ?

Both are predefined function of php.

htmlentities() — Convert all applicable characters to HTML entities.
<?php
$str = “A ‘quote’ is <b>bold</b>”;

// Outputs: A ‘quote’ is &lt;b&gt;bold&lt;/b&gt;
echo htmlentities($str);
?>
and
htmlspecialchars() — Convert special characters  to HTML entities.
<?php
$new = htmlspecialchars(”<a href=’test’>Test</a>”, ENT_QUOTES);
echo $new; // &lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;
?>

Special charachers are :
=&gt;  ‘&amp;’ (ampersand)
=&gt;  ‘”‘ (double quote)
=&gt;  ”’ (single quote)
=&gt;  ‘&lt;’ (less than)
=&gt;  ‘&gt;’ (greater than)